From 9f543d5058ab451c8d1220460a5c8b484fe6ebad Mon Sep 17 00:00:00 2001 From: Matteo Marsala Date: Mon, 19 Aug 2024 09:33:43 +0200 Subject: [PATCH 1/4] Clear runner --- .github/workflows/deploy-production.yml | 8 +++++++- .github/workflows/deploy-staging.yml | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index 9da1223121..4fcc45d0b8 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -26,7 +26,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - fetch-depth: 0 + fetch-depth: 1 - uses: actions/setup-node@v4 with: node-version: 18 @@ -66,6 +66,12 @@ jobs: - run: npm install - run: npm run build + - name: Clean up node_modules + run: rm -rf node_modules + + - name: Clean up workspace + run: sudo rm -rf /home/runner/work/* /home/runner/_work/* /tmp/* + - name: Configure AWS credentials from Production account uses: aws-actions/configure-aws-credentials@v4 with: diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index e6c5b6efeb..d6923a0293 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -25,7 +25,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - fetch-depth: 0 + fetch-depth: 1 - uses: actions/setup-node@v4 with: node-version: 18 From ac5c910b0f8cd415132a793c3626c2410378ae17 Mon Sep 17 00:00:00 2001 From: Matteo Marsala Date: Mon, 19 Aug 2024 09:34:10 +0200 Subject: [PATCH 2/4] Clear runner --- .github/workflows/deploy-staging.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index d6923a0293..1ede8da541 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -65,6 +65,12 @@ jobs: - run: npm install - run: npm run build + - name: Clean up node_modules + run: rm -rf node_modules + + - name: Clean up workspace + run: sudo rm -rf /home/runner/work/* /home/runner/_work/* /tmp/* + - name: Configure AWS credentials from Staging account uses: aws-actions/configure-aws-credentials@v4 with: From 5f3b44165d443124d80bca23fba1e8b5e7cae50f Mon Sep 17 00:00:00 2001 From: Matteo Marsala Date: Tue, 20 Aug 2024 15:59:43 +0200 Subject: [PATCH 3/4] Update actions --- .github/workflows/deploy-production.yml | 3 --- .github/workflows/deploy-staging.yml | 3 --- 2 files changed, 6 deletions(-) diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index 4fcc45d0b8..7c2e3cb055 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -69,9 +69,6 @@ jobs: - name: Clean up node_modules run: rm -rf node_modules - - name: Clean up workspace - run: sudo rm -rf /home/runner/work/* /home/runner/_work/* /tmp/* - - name: Configure AWS credentials from Production account uses: aws-actions/configure-aws-credentials@v4 with: diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index 1ede8da541..7176f9ba44 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -68,9 +68,6 @@ jobs: - name: Clean up node_modules run: rm -rf node_modules - - name: Clean up workspace - run: sudo rm -rf /home/runner/work/* /home/runner/_work/* /tmp/* - - name: Configure AWS credentials from Staging account uses: aws-actions/configure-aws-credentials@v4 with: From 2e9033621c49ff2a7712c85ef5f5e63e406a288c Mon Sep 17 00:00:00 2001 From: Matteo Marsala Date: Wed, 21 Aug 2024 08:08:48 +0200 Subject: [PATCH 4/4] undo purge cache --- .github/workflows/deploy-production.yml | 23 ++++++++++++------- .github/workflows/deploy-staging.yml | 30 ++++++++++++++++--------- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index 7c2e3cb055..cae7749e33 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -82,12 +82,19 @@ jobs: # Don't cache any HTML or JSON file: they should always be up-to-dates 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 }}/ - - name: Sync PDF - 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 }}/ + # - name: Sync PDF + # 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 }}/ - - name: Purge cache on CloudFlare - run: | - curl -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE }}/purge_cache" \ - -H "Authorization: Bearer ${{ secrets.CLOUDFLARE_PURGE_API_TOKEN }}" \ - -H "Content-Type: application/json" \ - --data '{"prefixes":["${{ vars.DATASHEETS_BASE_URL }}"]}' + # - name: Purge cache on CloudFlare + # run: | + # curl -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE }}/purge_cache" \ + # -H "Authorization: Bearer ${{ secrets.CLOUDFLARE_PURGE_API_TOKEN }}" \ + # -H "Content-Type: application/json" \ + # --data '{"prefixes":["${{ vars.DATASHEETS_BASE_URL }}"]}' + + - name: Sync all cacheable assets + 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 }}/ + + - name: Sync all non-cacheable assets + # Don't cache any HTML or JSON file: they should always be up-to-dates + 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 }}/ diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index 7176f9ba44..0c67404381 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -74,19 +74,27 @@ jobs: role-to-assume: ${{ secrets.STAGING_IAM_ROLE }} aws-region: us-east-1 + # - name: Sync all cacheable assets + # 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 }}/ + + # - name: Sync all non-cacheable assets + # # Don't cache any HTML or JSON file: they should always be up-to-dates + # 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 }}/ + + # - name: Sync PDF + # 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 }}/ + + # - name: Purge cache on CloudFlare + # run: | + # curl -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE }}/purge_cache" \ + # -H "Authorization: Bearer ${{ secrets.CLOUDFLARE_PURGE_API_TOKEN }}" \ + # -H "Content-Type: application/json" \ + # --data '{"prefixes":["${{ vars.DATASHEETS_BASE_URL }}"]}' + - name: Sync all cacheable assets - 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 }}/ + 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 }}/ - name: Sync all non-cacheable assets # Don't cache any HTML or JSON file: they should always be up-to-dates - 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 }}/ - - - name: Sync PDF - 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 }}/ + 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 }}/ - - name: Purge cache on CloudFlare - run: | - curl -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE }}/purge_cache" \ - -H "Authorization: Bearer ${{ secrets.CLOUDFLARE_PURGE_API_TOKEN }}" \ - -H "Content-Type: application/json" \ - --data '{"prefixes":["${{ vars.DATASHEETS_BASE_URL }}"]}'