Skip to content

Commit 4ec8c1c

Browse files
authored
Clear runner (#2124)
* Clear runner * Clear runner * Update actions * undo purge cache
1 parent c8de4b3 commit 4ec8c1c

File tree

2 files changed

+42
-21
lines changed

2 files changed

+42
-21
lines changed

.github/workflows/deploy-production.yml

+19-9
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
steps:
2727
- uses: actions/checkout@v4
2828
with:
29-
fetch-depth: 0
29+
fetch-depth: 1
3030
- uses: actions/setup-node@v4
3131
with:
3232
node-version: 18
@@ -66,6 +66,9 @@ jobs:
6666
- run: npm install
6767
- run: npm run build
6868

69+
- name: Clean up node_modules
70+
run: rm -rf node_modules
71+
6972
- name: Configure AWS credentials from Production account
7073
uses: aws-actions/configure-aws-credentials@v4
7174
with:
@@ -79,12 +82,19 @@ jobs:
7982
# Don't cache any HTML or JSON file: they should always be up-to-dates
8083
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.PRODUCTION_BUCKET_NAME }}/
8184

82-
- name: Sync PDF
83-
run: aws s3 sync --cache-control "public, max-age=86400, must-revalidate" --include "*.pdf" --exclude="*.js" --exclude="*.gif" --exclude="*.png" --exclude="*.svg" --exclude="*.css" --exclude="*.html" --exclude="*.json" --exclude="sw.json" --delete public/ s3://${{ secrets.PRODUCTION_BUCKET_NAME }}/
85+
# - name: Sync PDF
86+
# run: aws s3 sync --cache-control "public, max-age=86400, must-revalidate" --include "*.pdf" --exclude="*.js" --exclude="*.gif" --exclude="*.png" --exclude="*.svg" --exclude="*.css" --exclude="*.html" --exclude="*.json" --exclude="sw.json" --delete public/ s3://${{ secrets.PRODUCTION_BUCKET_NAME }}/
8487

85-
- name: Purge cache on CloudFlare
86-
run: |
87-
curl -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE }}/purge_cache" \
88-
-H "Authorization: Bearer ${{ secrets.CLOUDFLARE_PURGE_API_TOKEN }}" \
89-
-H "Content-Type: application/json" \
90-
--data '{"prefixes":["${{ vars.DATASHEETS_BASE_URL }}"]}'
88+
# - name: Purge cache on CloudFlare
89+
# run: |
90+
# curl -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE }}/purge_cache" \
91+
# -H "Authorization: Bearer ${{ secrets.CLOUDFLARE_PURGE_API_TOKEN }}" \
92+
# -H "Content-Type: application/json" \
93+
# --data '{"prefixes":["${{ vars.DATASHEETS_BASE_URL }}"]}'
94+
95+
- name: Sync all cacheable assets
96+
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 }}/
97+
98+
- name: Sync all non-cacheable assets
99+
# Don't cache any HTML or JSON file: they should always be up-to-dates
100+
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 }}/

.github/workflows/deploy-staging.yml

+23-12
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
steps:
2626
- uses: actions/checkout@v4
2727
with:
28-
fetch-depth: 0
28+
fetch-depth: 1
2929
- uses: actions/setup-node@v4
3030
with:
3131
node-version: 18
@@ -65,25 +65,36 @@ jobs:
6565
- run: npm install
6666
- run: npm run build
6767

68+
- name: Clean up node_modules
69+
run: rm -rf node_modules
70+
6871
- name: Configure AWS credentials from Staging account
6972
uses: aws-actions/configure-aws-credentials@v4
7073
with:
7174
role-to-assume: ${{ secrets.STAGING_IAM_ROLE }}
7275
aws-region: us-east-1
7376

77+
# - name: Sync all cacheable assets
78+
# 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 }}/
79+
80+
# - name: Sync all non-cacheable assets
81+
# # Don't cache any HTML or JSON file: they should always be up-to-dates
82+
# 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 }}/
83+
84+
# - name: Sync PDF
85+
# run: aws s3 sync --cache-control "public, max-age=86400, must-revalidate" --include "*.pdf" --exclude="*.js" --exclude="*.gif" --exclude="*.png" --exclude="*.svg" --exclude="*.css" --exclude="*.html" --exclude="*.json" --exclude="sw.json" --delete public/ s3://${{ secrets.STAGING_BUCKET_NAME }}/
86+
87+
# - name: Purge cache on CloudFlare
88+
# run: |
89+
# curl -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE }}/purge_cache" \
90+
# -H "Authorization: Bearer ${{ secrets.CLOUDFLARE_PURGE_API_TOKEN }}" \
91+
# -H "Content-Type: application/json" \
92+
# --data '{"prefixes":["${{ vars.DATASHEETS_BASE_URL }}"]}'
93+
7494
- name: Sync all cacheable assets
75-
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 }}/
95+
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 }}/
7696

7797
- name: Sync all non-cacheable assets
7898
# Don't cache any HTML or JSON file: they should always be up-to-dates
79-
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 }}/
80-
81-
- name: Sync PDF
82-
run: aws s3 sync --cache-control "public, max-age=86400, must-revalidate" --include "*.pdf" --exclude="*.js" --exclude="*.gif" --exclude="*.png" --exclude="*.svg" --exclude="*.css" --exclude="*.html" --exclude="*.json" --exclude="sw.json" --delete public/ s3://${{ secrets.STAGING_BUCKET_NAME }}/
99+
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 }}/
83100

84-
- name: Purge cache on CloudFlare
85-
run: |
86-
curl -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE }}/purge_cache" \
87-
-H "Authorization: Bearer ${{ secrets.CLOUDFLARE_PURGE_API_TOKEN }}" \
88-
-H "Content-Type: application/json" \
89-
--data '{"prefixes":["${{ vars.DATASHEETS_BASE_URL }}"]}'

0 commit comments

Comments
 (0)