From 0b66e95e098c5c238a497adf0d2d0573c48de807 Mon Sep 17 00:00:00 2001 From: James Johnson Date: Thu, 18 Dec 2025 11:04:08 +1000 Subject: [PATCH 1/2] TCLOUD-4866: Remove cache invalidation and add cache control headers --- .github/workflows/deploy_docs_v2.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deploy_docs_v2.yml b/.github/workflows/deploy_docs_v2.yml index 0ec6fe038b..44cd03b917 100644 --- a/.github/workflows/deploy_docs_v2.yml +++ b/.github/workflows/deploy_docs_v2.yml @@ -20,7 +20,6 @@ env: TARGET: ${{ inputs.environment || 'staging' }} ACCT: ${{ inputs.environment == 'production' && '990880627107' || '327995277200' }} BUCKET: ${{ inputs.environment == 'production' && 'tiny-cloud-antora-docs-release' || 'tiny-cloud-antora-docs-preview' }} - DISTRIBUTION: ${{ inputs.environment == 'production' && 'E3LFU502SQ5UR' || 'E7DUUPEI08HNW'}} RUN: run-${{ github.run_number }}-${{ github.run_attempt }} jobs: @@ -66,9 +65,15 @@ jobs: role-session-name: tinymce-docs-${{ env.TARGET }}-release aws-region: us-east-1 - - name: Upload website preview to S3 + - name: Upload website to S3 run: | - aws s3 sync ./build s3://${BUCKET}/main/${RUN} + aws s3 sync ./build s3://${BUCKET}/main/${RUN} \ + --exclude "index.html" \ + --cache-control "public, max-age=3600, stale-while-revalidate=86400" + aws s3 sync ./build s3://${BUCKET}/main/${RUN} \ + --exclude "*" \ + --include "index.html" \ + --cache-control "max-age=300, stale-while-revalidate=86400" - name: Create redirects on S3 uses: tinymce/tinymce-docs-generate-redirects-action@v1.0 @@ -89,9 +94,3 @@ jobs: bucket: ${{ env.BUCKET }} folder: main parallel: 20 - - - name: Invalidate Cloudfront Cache - # sleep to wait for envoy's version pointer caching to expire - run: | - sleep 30s - aws cloudfront create-invalidation --distribution-id ${{ env.DISTRIBUTION }} --paths "/docs/*" \ No newline at end of file From 9c03be20cda8877cb2ca66985d4ec80c934da679 Mon Sep 17 00:00:00 2001 From: James Johnson Date: Thu, 18 Dec 2025 11:39:19 +1000 Subject: [PATCH 2/2] TCLOUD-4866: Fix include/exclude patterns --- .github/workflows/deploy_docs_v2.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy_docs_v2.yml b/.github/workflows/deploy_docs_v2.yml index 44cd03b917..4cc8b32e25 100644 --- a/.github/workflows/deploy_docs_v2.yml +++ b/.github/workflows/deploy_docs_v2.yml @@ -68,11 +68,11 @@ jobs: - name: Upload website to S3 run: | aws s3 sync ./build s3://${BUCKET}/main/${RUN} \ - --exclude "index.html" \ + --exclude "*/index.html" \ --cache-control "public, max-age=3600, stale-while-revalidate=86400" aws s3 sync ./build s3://${BUCKET}/main/${RUN} \ --exclude "*" \ - --include "index.html" \ + --include "*/index.html" \ --cache-control "max-age=300, stale-while-revalidate=86400" - name: Create redirects on S3