From 92aab438e3387d98d63d1e5790abf85d4716a683 Mon Sep 17 00:00:00 2001 From: Martin Haug Date: Wed, 15 May 2024 10:24:38 +0200 Subject: [PATCH] Change caching behavior --- .github/workflows/deploy.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a8c8b859b..93f3609b4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -29,17 +29,31 @@ jobs: - name: Package run: bundler/target/release/bundler - - uses: azure/login@v1 + - uses: kheiakiyama/install-azcopy-action@v1 with: + version: 'v10' creds: ${{ secrets.AZURE_PACKAGE_CREDENTIALS }} - name: Sync files - uses: azure/CLI@v1 + env: + ACCOUNT_NAME: typstpackages + run: | + cd dist + azcopy_v10 cp --recursive . "https://$ACCOUNT_NAME.blob.core.windows.net/\$web" \ + --overwrite true --exclude-pattern '*.json' \ + --cache-control 'public, max-age=7776000' --put-md5 + + azcopy_v10 cp --recursive . "https://$ACCOUNT_NAME.blob.core.windows.net/\$web" \ + --overwrite true --include-pattern '*.json' \ + --cache-control 'must-revalidate' --put-md5 + + - name: Log in to Azure + uses: azure/login@v2 with: - inlineScript: az storage blob sync --account-name typstpackages --container '$web' --source ./dist --delete-destination true + creds: ${{ secrets.AZURE_PACKAGE_CREDENTIALS }} - name: Purge CDN endpoint - uses: azure/CLI@v1 + uses: azure/CLI@v2 with: inlineScript: az afd endpoint purge -g Landing-Page --profile-name LandingPage --content-paths '/*' --endpoint-name 'packages'