Skip to content

Commit b1e9a42

Browse files
committed
[NPM] Configure OIDC for trusted auto-publishing
1 parent ddf0222 commit b1e9a42

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

.github/workflows/release-on-npm.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
tags:
66
- 'v2.*.*'
77

8+
permissions:
9+
id-token: write # Required for OIDC
10+
contents: read
11+
812
jobs:
913
release:
1014
runs-on: ubuntu-latest
@@ -21,15 +25,20 @@ jobs:
2125
- name: Extract version from tag
2226
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
2327

28+
# npm 11.5.1 or later is required for OIDC
29+
- run: npm install -g npm@latest
30+
2431
- run: npm i -g corepack && corepack enable
2532
- uses: actions/setup-node@v4
2633
with:
34+
registry-url: 'https://registry.npmjs.org'
2735
node-version-file: '.nvmrc'
2836
cache: 'pnpm'
2937
cache-dependency-path: |
3038
pnpm-lock.yaml
3139
package.json
3240
src/**/package.json
41+
3342
- name: Install root JS dependencies
3443
run: pnpm install --frozen-lockfile
3544

@@ -41,11 +50,6 @@ jobs:
4150
git add .
4251
git commit -m "Update versions to ${{ env.VERSION }}"
4352
44-
- name: Configure NPM authentication
45-
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
46-
env:
47-
NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_TOKEN}}
48-
4953
- name: Publish on NPM
5054
run: pnpm publish --recursive --access public --no-git-checks
5155

0 commit comments

Comments
 (0)