From d717b6a51b3a7bb5f3c05397635161b0b4ddfaf0 Mon Sep 17 00:00:00 2001 From: Kian Date: Tue, 15 Oct 2024 16:13:58 +0100 Subject: [PATCH] [Docs Site] Cache Astro assets in ci.yml (#17487) * [Docs Site] Cache Astro assets in ci.yml * Cache whole Astro folder --- .github/workflows/ci.yml | 23 +++++++++++------------ .github/workflows/publish-preview.yml | 6 ++---- .github/workflows/publish-production.yml | 6 ++---- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9dc91e565774d4..109c1b1eca6c69 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,19 +20,12 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 22 - - - name: Get npm cache directory - id: npm-cache-dir - shell: bash - run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT} - - - uses: actions/cache@v4 - id: npm-cache + cache: "npm" + - uses: actions/cache/restore@v4 with: - path: ${{ steps.npm-cache-dir.outputs.dir }} - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- + path: | + node_modules/.astro + key: static - run: npm ci - run: npm run check @@ -44,6 +37,12 @@ jobs: NODE_OPTIONS: "--max-old-space-size=4192" RUN_LINK_CHECK: true + - uses: actions/cache/save@v4 + with: + path: | + node_modules/.astro + key: static + - name: Check - Validate redirects (infinite loops, sources with fragment) run: npx tsm bin/validate-redirects.ts diff --git a/.github/workflows/publish-preview.yml b/.github/workflows/publish-preview.yml index 8aa9c0b3720a9a..405fce150c642d 100644 --- a/.github/workflows/publish-preview.yml +++ b/.github/workflows/publish-preview.yml @@ -23,8 +23,7 @@ jobs: - uses: actions/cache/restore@v4 with: path: | - node_modules/.astro/_astro - node_modules/.astro/assets + node_modules/.astro key: static - run: npx astro build env: @@ -42,6 +41,5 @@ jobs: if: always() with: path: | - node_modules/.astro/_astro - node_modules/.astro/assets + node_modules/.astro key: static diff --git a/.github/workflows/publish-production.yml b/.github/workflows/publish-production.yml index df1289496b948f..c22b3c3f211dc4 100644 --- a/.github/workflows/publish-production.yml +++ b/.github/workflows/publish-production.yml @@ -19,8 +19,7 @@ jobs: - uses: actions/cache/restore@v4 with: path: | - node_modules/.astro/_astro - node_modules/.astro/assets + node_modules/.astro key: static - run: npx astro build env: @@ -38,6 +37,5 @@ jobs: if: always() with: path: | - node_modules/.astro/_astro - node_modules/.astro/assets + node_modules/.astro key: static