Skip to content

Commit d717b6a

Browse files
authored
[Docs Site] Cache Astro assets in ci.yml (#17487)
* [Docs Site] Cache Astro assets in ci.yml * Cache whole Astro folder
1 parent 555301e commit d717b6a

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,12 @@ jobs:
2020
- uses: actions/setup-node@v4
2121
with:
2222
node-version: 22
23-
24-
- name: Get npm cache directory
25-
id: npm-cache-dir
26-
shell: bash
27-
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
28-
29-
- uses: actions/cache@v4
30-
id: npm-cache
23+
cache: "npm"
24+
- uses: actions/cache/restore@v4
3125
with:
32-
path: ${{ steps.npm-cache-dir.outputs.dir }}
33-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
34-
restore-keys: |
35-
${{ runner.os }}-node-
26+
path: |
27+
node_modules/.astro
28+
key: static
3629

3730
- run: npm ci
3831
- run: npm run check
@@ -44,6 +37,12 @@ jobs:
4437
NODE_OPTIONS: "--max-old-space-size=4192"
4538
RUN_LINK_CHECK: true
4639

40+
- uses: actions/cache/save@v4
41+
with:
42+
path: |
43+
node_modules/.astro
44+
key: static
45+
4746
- name: Check - Validate redirects (infinite loops, sources with fragment)
4847
run: npx tsm bin/validate-redirects.ts
4948

.github/workflows/publish-preview.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ jobs:
2323
- uses: actions/cache/restore@v4
2424
with:
2525
path: |
26-
node_modules/.astro/_astro
27-
node_modules/.astro/assets
26+
node_modules/.astro
2827
key: static
2928
- run: npx astro build
3029
env:
@@ -42,6 +41,5 @@ jobs:
4241
if: always()
4342
with:
4443
path: |
45-
node_modules/.astro/_astro
46-
node_modules/.astro/assets
44+
node_modules/.astro
4745
key: static

.github/workflows/publish-production.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ jobs:
1919
- uses: actions/cache/restore@v4
2020
with:
2121
path: |
22-
node_modules/.astro/_astro
23-
node_modules/.astro/assets
22+
node_modules/.astro
2423
key: static
2524
- run: npx astro build
2625
env:
@@ -38,6 +37,5 @@ jobs:
3837
if: always()
3938
with:
4039
path: |
41-
node_modules/.astro/_astro
42-
node_modules/.astro/assets
40+
node_modules/.astro
4341
key: static

0 commit comments

Comments
 (0)