-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbitbucket-pipelines.yml
58 lines (50 loc) · 2.31 KB
/
bitbucket-pipelines.yml
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
pipelines:
custom:
build:
- step: &build
image: node:12.16.1
name: Build UI
caches:
- node
artifacts:
- dist/**
script:
# This section should actually build UI distribution. Could be used `$BITBUCKET_BRANCH` variable to choose proper build mode.
# In this example we just creating folder and copying `index.html` into it.
# `dist` folder will be submitted to CloudFront cache.
- mkdir dist
- cp -r ./src/* ./dist
branches:
master:
- step: *build
- step:
image: python:3.8.2
name: Deploy to STAGING
caches:
- pip
artifacts:
- generated.yaml
deployment: staging
script:
- pip install awscli
- echo "Making deployment package..."
- aws cloudformation package --region $AWS_DEFAULT_REGION --template-file formationStack.yaml --output-template-file generated.yaml --s3-bucket awsformation.deployments.domain.com
- echo "Updating AWS CloudFormation stack..."
- bash aws-cloudformation.sh deploy --template-file generated.yaml --stack-name staging-domain-com --capabilities CAPABILITY_NAMED_IAM --parameter-overrides ENV=staging AcmCertificateArn=ARN_of_ACM_certificate
- aws s3 sync ./dist/ s3://staging.domain.com
- # After first build - fill Distribution ID into next line and uncomment it.
- # aws cloudfront create-invalidation --distribution-id <ID of Distribution> --paths "/*"
- step:
image: python:3.8.2
name: Deploy to PROD
caches:
- pip
deployment: production
trigger: manual
script:
- pip install awscli
- echo "Updating AWS CloudFormation stack..."
- bash aws-cloudformation.sh deploy --template-file generated.yaml --stack-name domain-com --capabilities CAPABILITY_NAMED_IAM --parameter-overrides ENV=staging AcmCertificateArn=ARN_of_ACM_certificate
- aws s3 sync ./dist/ s3://domain.com
- # After first build - fill Distribution ID into next line and uncomment it.
- # aws cloudfront create-invalidation --distribution-id <ID of Distribution> --paths "/*"