Skip to content

Commit 5a3005c

Browse files
Update test-cache-restore.yml
1 parent 17bde3e commit 5a3005c

File tree

1 file changed

+12
-24
lines changed

1 file changed

+12
-24
lines changed

.github/workflows/test-cache-restore.yml

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,54 +13,42 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v6
1515

16-
# Setup Node.js and install pnpm
1716
- name: Setup Node.js
1817
id: setup-node
1918
uses: actions/setup-node@v6
2019
with:
2120
node-version: '21'
21+
package-manager-cache: true # IMPORTANT
2222

23-
# Install pnpm globally
24-
- name: Install pnpm
25-
run: npm install -g pnpm
26-
27-
# Normalize runner architecture
23+
# Normalize arch
2824
- name: Normalize runner architecture
2925
shell: bash
3026
run: |
3127
echo "ARCH=$(echo '${{ runner.arch }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
32-
33-
# Set pnpm cache path
34-
- name: Set pnpm cache path
28+
# Node equivalent of `go env GOMODCACHE`
29+
- name: Set Node cache path
3530
if: runner.os != 'Windows'
3631
shell: bash
3732
run: |
38-
echo "NODE_CACHE=$(pnpm store path)" >> $GITHUB_ENV
39-
40-
- name: Set pnpm cache path (Windows)
33+
set -e
34+
echo "NODE_CACHE=$(npm config get cache)" >> $GITHUB_ENV
35+
- name: Set Node cache path (Windows)
4136
if: runner.os == 'Windows'
4237
shell: pwsh
4338
run: |
44-
$cache = pnpm store path
45-
echo "NODE_CACHE=$cache" | Out-File $env:GITHUB_ENV -Append
46-
47-
# Debug cache env
39+
"NODE_CACHE=$(npm config get cache)" | Out-File $env:GITHUB_ENV -Append
4840
- name: Debug cache env
4941
run: |
5042
echo "ARCH=$ARCH"
5143
echo "NODE_CACHE=$NODE_CACHE"
52-
53-
# Restore pnpm cache
54-
- name: Restore pnpm cache
44+
- name: Restore Node cache
5545
uses: actions/cache/restore@v5
5646
with:
5747
path: ${{ env.NODE_CACHE }}
58-
key: node-cache-${{ runner.os }}-${{ env.ARCH }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
48+
key: node-cache-${{ runner.os }}-${{ env.ARCH }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml) }}
5949

60-
# Install dependencies
6150
- name: Install dependencies
62-
run: pnpm install
51+
run: pnpm ci
6352

64-
# Build
6553
- name: Build
66-
run: pnpm run build --if-present
54+
run: pnpm run build

0 commit comments

Comments
 (0)