ci: publish via npm trusted publishing (OIDC), drop NPM_TOKEN
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).
This commit is contained in:
@@ -17,7 +17,8 @@ jobs:
|
|||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '22'
|
node-version: '22'
|
||||||
registry-url: 'https://registry.npmjs.org'
|
# Trusted publishing (OIDC) needs npm >= 11.5.1; Node 22 ships npm 10.
|
||||||
- run: npm publish --provenance --access public
|
- run: npm install -g npm@latest
|
||||||
env:
|
# No token: id-token: write above lets npm authenticate via OIDC, and
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
# provenance is attached automatically. access set in publishConfig.
|
||||||
|
- run: npm publish
|
||||||
|
|||||||
Reference in New Issue
Block a user