Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0da19b9

Browse files
committedJul 22, 2024·
Add pdf sync and invalidate old cloudflare cache
1 parent f62a66d commit 0da19b9

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed
 

‎.github/workflows/deploy-production.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ jobs:
7575
- name: Sync all cacheable assets
7676
run: aws s3 sync --cache-control "public, max-age=31536000, immutable" --include "*.css" --include="*.js" --include="*.gif" --include="*.png" --include="*.svg" --exclude "*.html" --exclude="sw.js" --exclude="*.json" --delete public/ s3://${{ secrets.PRODUCTION_BUCKET_NAME }}/
7777

78-
- name: Sync all non-cacheable assets
78+
- name: Sync PDF and invalidate old cache
7979
# Don't cache any HTML or JSON file: they should always be up-to-dates
8080
run: aws s3 sync --cache-control "public, max-age=0, must-revalidate" --include "*.html" --include="sw.js" --include="*.json" --include "*.css" --exclude="*.js" --exclude="*.gif" --exclude="*.png" --exclude="*.svg" --delete public/ s3://${{ secrets.PRODUCTION_BUCKET_NAME }}/
81+
82+
- name: Sync PDF
83+
run: aws s3 sync --cache-control "public, max-age=86400, must-revalidate" --include "*.pdf" --delete public/ s3://${{ secrets.STAGING_BUCKET_NAME }}/
84+
85+
- name: Invalidate cloudflare cache
86+
uses: nathanvaughn/actions-cloudflare-purge@master
87+
with:
88+
cf_zone: ${{ secrets.CLOUDFLARE_ZONE }}
89+
cf_auth: ${{ secrets.CLOUDFLARE_AUTH_KEY }}

‎.github/workflows/deploy-staging.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,17 @@ jobs:
7373
aws-region: us-east-1
7474

7575
- name: Sync all cacheable assets
76-
run: aws s3 sync --cache-control "public, max-age=31536000, immutable" --include "*.css" --include="*.js" --include="*.gif" --include="*.png" --include="*.svg" --exclude "*.html" --exclude="sw.js" --exclude="*.json" --delete public/ s3://${{ secrets.STAGING_BUCKET_NAME }}/
76+
run: aws s3 sync --cache-control "public, max-age=31536000, immutable" --include "*.css" --include="*.js" --include="*.gif" --include="*.png" --include="*.svg" --exclude "*.html" --exclude="sw.js" --exclude="*.json" --exclude="*.pdf" --delete public/ s3://${{ secrets.STAGING_BUCKET_NAME }}/
7777

7878
- name: Sync all non-cacheable assets
7979
# Don't cache any HTML or JSON file: they should always be up-to-dates
80-
run: aws s3 sync --cache-control "public, max-age=0, must-revalidate" --include "*.html" --include="sw.js" --include="*.json" --include "*.css" --exclude="*.js" --exclude="*.gif" --exclude="*.png" --exclude="*.svg" --delete public/ s3://${{ secrets.STAGING_BUCKET_NAME }}/
80+
run: aws s3 sync --cache-control "public, max-age=0, must-revalidate" --include "*.html" --include="sw.js" --include="*.json" --include "*.css" --exclude="*.js" --exclude="*.gif" --exclude="*.png" --exclude="*.svg" --exclude="*.pdf" --delete public/ s3://${{ secrets.STAGING_BUCKET_NAME }}/
81+
82+
- name: Sync PDF
83+
run: aws s3 sync --cache-control "public, max-age=86400, must-revalidate" --include "*.pdf" --delete public/ s3://${{ secrets.STAGING_BUCKET_NAME }}/
84+
85+
- name: Invalidate cloudflare cache
86+
uses: nathanvaughn/actions-cloudflare-purge@master
87+
with:
88+
cf_zone: ${{ secrets.CLOUDFLARE_ZONE }}
89+
cf_auth: ${{ secrets.CLOUDFLARE_AUTH_KEY }}

0 commit comments

Comments
 (0)
Please sign in to comment.