Skip to content

Commit 71273c0

Browse files
committed
fix(ci): migrate release workflow from npm to pnpm with caching
1 parent f2799fb commit 71273c0

File tree

1 file changed

+42
-8
lines changed

1 file changed

+42
-8
lines changed

.github/workflows/release.yml

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,34 @@ jobs:
4242
with:
4343
node-version: 22.x
4444

45+
- uses: pnpm/action-setup@v4
46+
with:
47+
version: 10.6.1
48+
49+
- name: Get pnpm store directory
50+
shell: bash
51+
run: |
52+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
53+
54+
- uses: actions/cache@v4
55+
name: Setup pnpm cache
56+
with:
57+
path: ${{ env.STORE_PATH }}
58+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
59+
restore-keys: |
60+
${{ runner.os }}-pnpm-store-
61+
4562
- name: Install dependencies
46-
run: npm install
63+
run: pnpm install --frozen-lockfile
4764

4865
- name: Lint
49-
run: npm run lint
66+
run: pnpm run lint
5067

5168
- name: Build
52-
run: npm run build
69+
run: pnpm run build
5370

5471
- name: Run tests
55-
run: npm test || echo "No tests found, skipping test step"
72+
run: pnpm test || echo "No tests found, skipping test step"
5673

5774
publish:
5875
runs-on: ubuntu-latest
@@ -67,11 +84,28 @@ jobs:
6784
node-version: 22.x
6885
registry-url: 'https://registry.npmjs.org'
6986

87+
- uses: pnpm/action-setup@v4
88+
with:
89+
version: 10.6.1
90+
91+
- name: Get pnpm store directory
92+
shell: bash
93+
run: |
94+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
95+
96+
- uses: actions/cache@v4
97+
name: Setup pnpm cache
98+
with:
99+
path: ${{ env.STORE_PATH }}
100+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
101+
restore-keys: |
102+
${{ runner.os }}-pnpm-store-
103+
70104
- name: Install dependencies
71-
run: npm install
105+
run: pnpm install --frozen-lockfile
72106

73107
- name: Build
74-
run: npm run build
108+
run: pnpm run build
75109

76110
- name: Generate changelog
77111
id: changelog
@@ -88,12 +122,12 @@ jobs:
88122
body: |
89123
${{ steps.changelog.outputs.changelog }}
90124
91-
**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ github.ref_name }}...HEAD
125+
**Full Changelog**: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}
92126
draft: false
93127
prerelease: false
94128

95129
- name: Publish to NPM
96-
run: npm publish
130+
run: pnpm publish
97131
env:
98132
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
99133

0 commit comments

Comments
 (0)