Skip to content

Commit d2d8aa2

Browse files
authored
fix: caching for cloudfront (#159)
1 parent b854570 commit d2d8aa2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/.deploy_stack.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@ jobs:
132132
S3_BUCKET_ARN: ${{ needs.deploy.outputs.S3_BUCKET_ARN }}
133133
CF_DISTRIBUTION_ID: ${{ needs.deploy.outputs.CF_DISTRIBUTION_ID }}
134134
run: |
135+
BUCKET=$(echo "$S3_BUCKET_ARN" | cut -d: -f6)
135136
npm run deploy
136-
aws s3 sync --delete ./dist s3://$(echo "$S3_BUCKET_ARN" | cut -d: -f6)
137+
aws s3 cp ./dist/index.html s3://$BUCKET/index.html \
138+
--cache-control "no-cache, must-revalidate" \
139+
--content-type "text/html"
140+
aws s3 sync ./dist s3://$BUCKET \
141+
--exclude "index.html" \
142+
--cache-control "public, max-age=31536000, immutable" \
143+
--delete
137144
aws cloudfront create-invalidation --distribution-id $CF_DISTRIBUTION_ID --paths "/*"

0 commit comments

Comments
 (0)