feat(ci): auto-invalidate cloudfront cache
This commit is contained in:
parent
d213110e30
commit
4fc8d4831d
2 changed files with 15 additions and 0 deletions
7
.github/workflows/aws.yaml
vendored
7
.github/workflows/aws.yaml
vendored
|
|
@ -39,3 +39,10 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
chmod +x scripts/deploy.sh
|
chmod +x scripts/deploy.sh
|
||||||
scripts/deploy.sh
|
scripts/deploy.sh
|
||||||
|
|
||||||
|
- name: Invalidate CloudFront cache
|
||||||
|
env:
|
||||||
|
AWS_CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }}
|
||||||
|
run: |
|
||||||
|
chmod +x scripts/invalidate.sh
|
||||||
|
scripts/invalidate.sh
|
||||||
|
|
|
||||||
8
scripts/invalidate.sh
Normal file
8
scripts/invalidate.sh
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ -z "$AWS_CLOUDFRONT_DISTRIBUTION_ID" ]; then
|
||||||
|
echo 'No cloudfront distribution id found.'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
aws cloudfront create-invalidation --distribution-id "$AWS_CLOUDFRONT_DISTRIBUTION_ID" --paths "/*"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue