Skip to content

Commit 7ba7cd1

Browse files
zhengyangliuclaude
andcommitted
ci: switch npm publish to Trusted Publishing (OIDC)
Replace token-based JS-DevTools/npm-publish@v1 with native `npm publish --provenance` using GitHub OIDC. Bumps Node to 22.x and upgrades npm to satisfy the >=11.5.1 requirement for trusted publishing, and grants `id-token: write` so the job can mint the OIDC token npm exchanges for publish credentials. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent a8251ec commit 7ba7cd1

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

.github/workflows/publish-npm-package.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,22 @@ on:
88
jobs:
99
publish:
1010
runs-on: ubuntu-latest
11+
permissions:
12+
id-token: write
13+
contents: read
1114
steps:
1215
- uses: actions/checkout@v4
1316

1417
- uses: actions/setup-node@v4
1518
with:
16-
node-version: '16.x'
19+
node-version: '22.x'
1720
registry-url: 'https://registry.npmjs.org'
1821

22+
- name: Upgrade npm for Trusted Publishing
23+
run: npm install -g npm@latest
24+
1925
- name: Install dependencies
2026
run: npm ci
2127

22-
- uses: JS-DevTools/npm-publish@v1
23-
with:
24-
token: ${{ secrets.NPM_TOKEN }}
28+
- name: Publish to npm
29+
run: npm publish --provenance --access public

0 commit comments

Comments
 (0)