This repository has been archived by the owner on Sep 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (53 loc) · 1.86 KB
/
deploy-testing.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
name: Deploy Testing
env:
AWS_DEFAULT_REGION: us-east-1
STACK_NAME: rdok-testing-cyberpunk2077-countdown
DEPLOY_BUCKET: rdok-testing-deployments-us-east-1
DOMAIN: testing-cyberpunk2077-countdown.rdok.co.uk
ENVIRONMENT: testing
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
on:
workflow_dispatch:
push:
jobs:
deliver:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: CloudFormation Package & Deploy
run: |
sam package \
--output-template-file packaged-template.yml \
--s3-prefix "${STACK_NAME}/packages" \
--s3-bucket "${DEPLOY_BUCKET}"
sam deploy \
--no-fail-on-empty-changeset \
--s3-bucket "$DEPLOY_BUCKET" \
--s3-prefix "${STACK_NAME}/deployments" \
--template-file packaged-template.yml \
--stack-name "$STACK_NAME" \
--capabilities CAPABILITY_IAM \
--parameter-overrides \
Route53HostedZoneId=ZSY7GT2NEDPN0 \
DomainName=${DOMAIN}
- name: Website Bucket Sync
run: |
BUCKET_NAME=$( \
aws cloudformation describe-stacks \
--stack-name "$STACK_NAME" \
--query 'Stacks[0].Outputs[?OutputKey==`WebsiteBucket`].OutputValue' \
--output text \
)
aws s3 sync ./public s3://${BUCKET_NAME} --delete
- name: Cache Invalidation
run: |
DISTRIBUTION_ID=$( \
aws cloudformation describe-stacks \
--stack-name "$STACK_NAME" \
--query 'Stacks[0].Outputs[?OutputKey==`DistributionID`].OutputValue' \
--output text \
)
aws cloudfront create-invalidation \
--distribution-id "$DISTRIBUTION_ID" \
--paths "/*"