Skip to content

Commit 1f35ab4

Browse files
committed
Fix: Update release workflow to use pnpm
1 parent e2d55dd commit 1f35ab4

File tree

1 file changed

+24
-43
lines changed

1 file changed

+24
-43
lines changed

.github/workflows/release.yml

Lines changed: 24 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -36,69 +36,53 @@ jobs:
3636
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
3737
with:
3838
node-version: 20
39-
cache: 'npm'
40-
41-
- name: Ensure npm cache directory exists (Windows)
42-
if: runner.os == 'Windows'
39+
- name: Setup pnpm
40+
uses: pnpm/action-setup@v2
41+
with:
42+
version: latest
43+
- name: Get pnpm store directory
44+
shell: bash
4345
run: |
44-
powershell -Command "New-Item -Path 'C:\npm\cache' -ItemType Directory -Force | Out-Null"
46+
echo "store_path=$(pnpm store path --silent)" >> $GITHUB_ENV
4547
46-
- name: Cache npm cache and node_modules
47-
uses: actions/cache@v4
48+
- uses: actions/cache@v3
49+
name: Setup pnpm cache
4850
with:
49-
path: |
50-
${{ runner.os == 'Windows' && 'C:\\npm\\cache' || '~/.npm' }}
51-
node_modules
52-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
51+
path: ${{ env.store_path }}
52+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
5353
restore-keys: |
54-
${{ runner.os }}-node-
54+
${{ runner.os }}-pnpm-store-
5555
5656
- name: Clean up potential corrupted install (CI-only)
5757
run: |
58-
if [ "${{ runner.os }}" = "Windows" ]; then
59-
powershell -Command "if (Test-Path node_modules) { Remove-Item -Recurse -Force node_modules } ; if (Test-Path package-lock.json) { Remove-Item -Force package-lock.json }"
60-
else
61-
rm -rf node_modules package-lock.json || true
62-
fi
58+
rm -rf node_modules
59+
rm -f pnpm-lock.yaml
60+
rm -rf .pnpm-store
61+
pnpm store prune --force || true
6362
shell: bash
6463

65-
- name: Configure npm for CI (cache path + disable optional deps)
66-
run: |
67-
if [ "${{ runner.os }}" = "Windows" ]; then
68-
npm config set cache "C:\\npm\\cache" --global
69-
else
70-
npm config set cache "${HOME}/.npm" --global
71-
fi
72-
npm config set optional false --global
73-
shell: bash
7464

75-
- name: Install dependencies (npm ci || npm install fallback)
76-
run: |
77-
set -e
78-
if [ "${{ runner.os }}" = "Windows" ]; then
79-
npm ci --no-audit --prefer-offline || (powershell -Command "if (Test-Path package-lock.json) { Remove-Item -Force package-lock.json }" ; npm install --no-audit --prefer-offline)
80-
else
81-
npm ci --no-audit --prefer-offline || (rm -f package-lock.json && npm install --no-audit --prefer-offline)
82-
fi
65+
- name: Install dependencies
66+
run: pnpm install --frozen-lockfile
8367
shell: bash
8468

8569
- name: Try rebuild rollup native binary (non-fatal)
8670
run: |
8771
if [[ "${{ matrix.os.name }}" == "linux" ]]; then
88-
npm rebuild @rollup/rollup-linux-x64-gnu || true
72+
pnpm rebuild @rollup/rollup-linux-x64-gnu || true
8973
elif [[ "${{ matrix.os.name }}" == "macos-intel" ]]; then
90-
npm rebuild @rollup/rollup-darwin-x64 || true
74+
pnpm rebuild @rollup/rollup-darwin-x64 || true
9175
elif [[ "${{ matrix.os.name }}" == "macos" ]]; then
92-
npm rebuild @rollup/rollup-darwin-arm64 || true
76+
pnpm rebuild @rollup/rollup-darwin-arm64 || true
9377
elif [[ "${{ matrix.os.name }}" == "windows" ]]; then
94-
npm rebuild @rollup/rollup-win32-x64-msvc || true
78+
pnpm rebuild @rollup/rollup-win32-x64-msvc || true
9579
fi
9680
shell: bash
9781

9882
- name: Build
9983
env:
10084
NODE_OPTIONS: "--max-old-space-size=4096"
101-
run: npm run build
85+
run: pnpm run build
10286
shell: bash
10387

10488
- name: Publish app
@@ -109,10 +93,7 @@ jobs:
10993
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
11094
APPLE_ID: ${{ secrets.APPLE_ID }}
11195
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
112-
run: |
113-
set -e
114-
echo "=== Running publish (npm run publish) ==="
115-
npm run publish 2>&1 | sed -n '1,500p'
96+
run: pnpm run publish
11697
shell: bash
11798

11899
- name: Wait for GitHub to register release uploads

0 commit comments

Comments
 (0)