Skip to content

Commit e21442b

Browse files
ryanioclaude
andauthored
Migrate npm publishing to trusted publishers (#496)
Switch from manual NPM_TOKEN authentication to OpenID Connect (OIDC) trusted publishing. This provides better security by: - Eliminating the need to manage long-lived NPM tokens as secrets - Using short-lived OIDC tokens generated by GitHub Actions - Adding provenance attestations to published packages Changes: - Add id-token: write and contents: read permissions - Use --provenance flag for npm publish - Remove NODE_AUTH_TOKEN secret usage Requires configuration on npmjs.com to add GitHub Actions as a trusted publisher before this workflow will work. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
1 parent 73efccc commit e21442b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

.github/workflows/npm-publish.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
jobs:
1111
publish-npm:
1212
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
id-token: write
1316
steps:
1417
- uses: actions/checkout@v5
1518
- uses: actions/setup-node@v6
@@ -19,6 +22,4 @@ jobs:
1922
- run: npm ci
2023
- run: npm run build
2124
- run: npm test
22-
- run: npm publish
23-
env:
24-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
25+
- run: npm publish --provenance --access public

0 commit comments

Comments
 (0)