Skip to content

Commit 36ba572

Browse files
author
mbarber
committed
added inval
1 parent a4abdf3 commit 36ba572

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.github/workflows/s3.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- develop
7+
- prod
78

89
jobs:
910
build_and_sync:
@@ -38,6 +39,19 @@ jobs:
3839
echo $bucket; \
3940
echo "bucket=$bucket" >> $GITHUB_OUTPUT
4041
id: bucket_name
42+
43+
- name: Get distribution ID
44+
shell: bash
45+
run: |
46+
branch=$(echo ${GITHUB_REF#refs/heads/}); \
47+
if [ $branch == 'develop' ]; \
48+
then dist=E3SMW2DYY71HHW; \
49+
elif [ $branch == 'prod' ]; \
50+
then dist=E1CUT1CP31D5NK; \
51+
else exit 1; fi; \
52+
echo $dist; \
53+
echo "dist=$dist" >> $GITHUB_OUTPUT
54+
id: dist_id
4155

4256
- name: Configure AWS credentials
4357
uses: aws-actions/configure-aws-credentials@v1
@@ -52,3 +66,9 @@ jobs:
5266
shell: bash
5367
run: |
5468
aws s3 sync apidocs/_build/html s3://${AWS_S3_BUCKET}/apidocs/
69+
70+
- name: Invalidate CloudFront cache
71+
env:
72+
DISTRIBUTION_ID: ${{ steps.dist_id.outputs.dist }}
73+
run: |
74+
aws cloudfront create-invalidation --distribution-id ${DISTRIBUTION_ID} --paths "/apidocs/*"

0 commit comments

Comments
 (0)