Skip to content

Commit f0a6add

Browse files
committed
chore: update npm upgrade strategy and implement pnpm caching in publish workflow
1 parent e69f01f commit f0a6add

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

.github/workflows/publish-trusted.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,28 @@ jobs:
2525
registry-url: 'https://registry.npmjs.org'
2626
package-manager-cache: false
2727

28+
# npm >= 11.5.1 is required for OIDC trusted publishing
29+
# npm self-upgrade is broken on ubuntu-24.04 runners (missing promise-retry)
30+
# Use npx to bootstrap a fresh npm copy that can perform the upgrade
31+
- name: Update npm for trusted publishing
32+
run: npx -y npm@latest install -g npm@latest
33+
2834
- name: Install pnpm
2935
run: |
3036
npm install -g pnpm@10.23.0
3137
pnpm --version
3238
33-
# Ensure npm 11.5.1 or later is installed for trusted publishing support
34-
- name: Update npm to latest version
35-
run: npm install -g npm@latest
39+
- name: Get pnpm store directory
40+
shell: bash
41+
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
42+
43+
- name: Setup pnpm cache
44+
uses: actions/cache@v4
45+
with:
46+
path: ${{ env.STORE_PATH }}
47+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
48+
restore-keys: |
49+
${{ runner.os }}-pnpm-store-
3650
3751
- name: Install dependencies
3852
run: pnpm install --frozen-lockfile

0 commit comments

Comments
 (0)