Skip to content

Commit 0268d9f

Browse files
committed
ci: publish to npm through trusted publishing instead of a token
1 parent fc2f748 commit 0268d9f

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ jobs:
1111

1212
permissions:
1313
contents: read
14+
# Trusted publishing (OIDC): npm accepts this repo + this workflow file name,
15+
# so renaming npm-publish.yml needs the same change on the npm package settings.
16+
id-token: write
1417

1518
steps:
1619
- name: Checkout
@@ -23,6 +26,10 @@ jobs:
2326
registry-url: 'https://registry.npmjs.org'
2427
cache: 'npm'
2528

29+
- name: Update npm for trusted publishing
30+
# Node 22 ships npm 10; trusted publishing needs npm 11.5.1 or later.
31+
run: npm install -g npm@11
32+
2633
- name: Install dependencies
2734
run: npm ci
2835

@@ -82,5 +89,3 @@ jobs:
8289

8390
- name: Publish
8491
run: npm publish --access public
85-
env:
86-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)