Skip to content

Commit 0480a34

Browse files
committed
ci: publish to npm with trusted publishing (OIDC) instead of NPM_TOKEN
1 parent ff6464d commit 0480a34

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎.github/workflows/publish.yml‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,20 @@ on:
77
jobs:
88
publish:
99
runs-on: ubuntu-latest
10+
# npm trusted publishing: npm exchanges the GitHub OIDC token for a
11+
# short-lived publish credential, so no NPM_TOKEN secret is needed.
12+
permissions:
13+
contents: read
14+
id-token: write
1015

1116
steps:
1217
- uses: actions/checkout@v4
1318

1419
- name: Setup Node.js
1520
uses: actions/setup-node@v4
1621
with:
17-
node-version: '18'
22+
# Trusted publishing needs npm 11.5.1 or later, which Node 24 ships.
23+
node-version: '24'
1824
cache: 'npm'
1925
registry-url: 'https://registry.npmjs.org'
2026

@@ -57,5 +63,3 @@ jobs:
5763

5864
- name: Publish to npm
5965
run: npm publish
60-
env:
61-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)