From 1c33b498a9b1dc1573b80ac0298c13e9835587ce Mon Sep 17 00:00:00 2001 From: ivan-angjelkoski Date: Tue, 16 Jun 2026 14:13:48 +0200 Subject: [PATCH] chore/update-cloudfront-action --- actions/deploy/s3-cloudfront/action.yml | 71 +++++++++++++++++-------- 1 file changed, 49 insertions(+), 22 deletions(-) diff --git a/actions/deploy/s3-cloudfront/action.yml b/actions/deploy/s3-cloudfront/action.yml index 378a927..f9601ef 100644 --- a/actions/deploy/s3-cloudfront/action.yml +++ b/actions/deploy/s3-cloudfront/action.yml @@ -17,32 +17,53 @@ outputs: runs: using: 'composite' steps: - - name: Upload new assets to S3 + - name: Upload immutable Nuxt assets to S3 + shell: bash + run: | + aws s3 sync .output/public/_nuxt/ s3://${{ inputs.s3-bucket }}/_nuxt/ --follow-symlinks \ + --exclude "*.map" \ + --exclude "builds/*" \ + --exclude "manifest.json" \ + --cache-control "public,max-age=2592000,immutable" + + - name: Upload cacheable static assets to S3 shell: bash run: | aws s3 sync .output/public/ s3://${{ inputs.s3-bucket }}/ --follow-symlinks \ - --exclude "*.html" --exclude "*.map" \ - --exclude "_nuxt/builds/*" --exclude "_nuxt/manifest.json" \ - --exclude "robots.txt" --exclude "favicon*" \ - --exclude "manifest.json" --exclude "site.webmanifest" \ - --exclude "browserconfig.xml" --exclude "sitemap.xml" \ - --cache-control "max-age=2592000,public" \ - --expires 2034-01-01T00:00:00Z + --exclude "_nuxt/*" \ + --exclude "*.html" \ + --exclude "*.map" \ + --exclude "_payload.json" \ + --exclude "*/_payload.json" \ + --exclude "robots.txt" \ + --exclude "favicon*" \ + --exclude "manifest.json" \ + --exclude "site.webmanifest" \ + --exclude "browserconfig.xml" \ + --exclude "sitemap.xml" \ + --cache-control "public,max-age=2592000" - name: Upload HTML and no-cache files to S3 shell: bash run: | aws s3 sync .output/public/ s3://${{ inputs.s3-bucket }}/ --follow-symlinks \ - --exclude "*" --include "*.html" \ - --cache-control "no-cache" + --exclude "*" \ + --include "*.html" \ + --include "_payload.json" \ + --include "*/_payload.json" \ + --cache-control "no-cache,max-age=0" aws s3 sync .output/public/ s3://${{ inputs.s3-bucket }}/ --follow-symlinks \ --exclude "*" \ - --include "_nuxt/builds/*" --include "_nuxt/manifest.json" \ - --include "robots.txt" --include "favicon*" \ - --include "manifest.json" --include "site.webmanifest" \ - --include "browserconfig.xml" --include "sitemap.xml" \ - --cache-control "no-cache" + --include "_nuxt/builds/*" \ + --include "_nuxt/manifest.json" \ + --include "robots.txt" \ + --include "favicon*" \ + --include "manifest.json" \ + --include "site.webmanifest" \ + --include "browserconfig.xml" \ + --include "sitemap.xml" \ + --cache-control "no-cache,max-age=0" - name: Delete stale assets from S3 shell: bash @@ -50,15 +71,21 @@ runs: aws s3 sync .output/public/ s3://${{ inputs.s3-bucket }}/ --follow-symlinks --delete \ --exclude "cf-logs/*" \ --exclude "_nuxt/*" \ - --exclude "*.html" --exclude "*.map" \ - --exclude "robots.txt" --exclude "favicon*" \ - --exclude "manifest.json" --exclude "site.webmanifest" \ - --exclude "browserconfig.xml" --exclude "sitemap.xml" \ - --cache-control "max-age=2592000,public" \ - --expires 2034-01-01T00:00:00Z + --exclude "*.html" \ + --exclude "*.map" \ + --exclude "_payload.json" \ + --exclude "*/_payload.json" \ + --exclude "robots.txt" \ + --exclude "favicon*" \ + --exclude "manifest.json" \ + --exclude "site.webmanifest" \ + --exclude "browserconfig.xml" \ + --exclude "sitemap.xml" \ + --cache-control "public,max-age=2592000" aws s3 rm s3://${{ inputs.s3-bucket }}/ --recursive \ - --exclude "*" --include "*.map" + --exclude "*" \ + --include "*.map" - name: Invalidate CloudFront id: invalidate