-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbitbucket-pipelines.yml
More file actions
64 lines (59 loc) · 2.79 KB
/
bitbucket-pipelines.yml
File metadata and controls
64 lines (59 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
image: node:10.15.3
definitions:
caches:
sonar: ~/.sonar/cache # Caching SonarCloud artifacts will speed up your build
services:
docker:
memory: 2048
steps:
- step: &build-app
name: "Build"
image: node:14.15.4-alpine3.12
script:
- unset NPM_CONFIG_USER # solving the problem with installing the cypress - https://github.com/cypress-io/cypress/issues/15025
- npm install
- npm run build-storybook
artifacts:
- storybook-static/**
- step: &deploy-app
name: "Deploy to Environment"
image: atlassian/pipelines-awscli
script:
- source infra/config-files/${CONFIG_FILE_SUFFIX}
- chmod +x infra/scripts/*
- export CERTIFICATE_ARN=`./infra/scripts/getCertificate.sh us-east-1 *.${HOSTED_ZONE_NAME:0:-1}`
- aws cloudformation deploy --region $REGION --stack-name ${CLOUDFORMATION_STACKNAME}-cloudfront --capabilities CAPABILITY_NAMED_IAM --no-fail-on-empty-changeset --template-file infra/cloudformation/service-cloudfront.yml --parameter-overrides CNAME=$SITE_URL CertificateArn=$CERTIFICATE_ARN ProjectName=$APP_NAME ClusterName=$CLUSTER_NAME PrefixName=$PREFIX_NAME
- echo "aws ssm get-parameter --region $REGION --with-decryption --name /ECS-CLUSTER/${CLUSTER_NAME}/${APP_NAME}/DISTRIBUTION_ID --output text --query Parameter.Value"
- echo "aws ssm get-parameter --region $REGION --with-decryption --name /ECS-CLUSTER/${CLUSTER_NAME}/${APP_NAME}/AWS_S3 --output text --query Parameter.Value"
- export DISTRIBUTION_ID=`aws ssm get-parameter --region $REGION --with-decryption --name /ECS-CLUSTER/${CLUSTER_NAME}/${APP_NAME}/DISTRIBUTION_ID --output text --query Parameter.Value`
- export AWS_S3="`aws ssm get-parameter --region $REGION --with-decryption --name /ECS-CLUSTER/${CLUSTER_NAME}/${APP_NAME}/AWS_S3 --output text --query Parameter.Value`"
- aws s3 sync --delete storybook-static/ s3://$AWS_S3
- aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths /index.html "/static"
- step: &push-to-github
name: Push to GitHub
script:
- git fetch --unshallow origin
- git remote set-url origin git@github.com:openchannel/react-template-libraries.git
- git remote -v
- git push origin master:main
- git push origin --force --tags
pipelines:
custom:
Deploy to dev1:
- step: *build-app
- step:
<<: *deploy-app
deployment: dev1
Deploy to stage1:
- step: *build-app
- step:
<<: *deploy-app
deployment: stage1
Deploy to us1:
- step: *build-app
- step:
<<: *deploy-app
deployment: us1
branches:
master:
- step: *push-to-github