Skip to content

Commit 7d303b7

Browse files
ci: publish via npm trusted publishing (OIDC), drop NPM_TOKEN (#282)
Authenticate the release workflow through GitHub OIDC instead of a long-lived npm token: no secret to leak or rotate, provenance attached automatically. Upgrade npm on the runner since OIDC publishing needs npm >= 11.5.1 (Node 22 ships npm 10).
1 parent e368c48 commit 7d303b7

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎.github/workflows/publish.yml‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ jobs:
1717
- uses: actions/setup-node@v4
1818
with:
1919
node-version: '22'
20-
registry-url: 'https://registry.npmjs.org'
21-
- run: npm publish --provenance --access public
22-
env:
23-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
20+
# Trusted publishing (OIDC) needs npm >= 11.5.1; Node 22 ships npm 10.
21+
- run: npm install -g npm@latest
22+
# No token: id-token: write above lets npm authenticate via OIDC, and
23+
# provenance is attached automatically. access set in publishConfig.
24+
- run: npm publish

0 commit comments

Comments
 (0)