Skip to content

Commit

Permalink
[Docs Site] Cache Astro assets in ci.yml (#17487)
Browse files Browse the repository at this point in the history
* [Docs Site] Cache Astro assets in ci.yml

* Cache whole Astro folder
  • Loading branch information
KianNH authored Oct 15, 2024
1 parent 555301e commit d717b6a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
23 changes: 11 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/publish-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -42,6 +41,5 @@ jobs:
if: always()
with:
path: |
node_modules/.astro/_astro
node_modules/.astro/assets
node_modules/.astro
key: static
6 changes: 2 additions & 4 deletions .github/workflows/publish-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -38,6 +37,5 @@ jobs:
if: always()
with:
path: |
node_modules/.astro/_astro
node_modules/.astro/assets
node_modules/.astro
key: static

0 comments on commit d717b6a

Please sign in to comment.