Skip to content

Commit 9dd856d

Browse files
ericscipleCopilot
andauthored
Switch to npm trusted publishing (OIDC) (#327)
Replace NPM_TOKEN-based authentication with OIDC trusted publishing. This eliminates the need for long-lived npm access tokens. Changes: - Add id-token: write permission to the release job - Add registry-url to setup-node - Remove the setup authentication step (.npmrc token write) - Remove NPM_TOKEN env var from the Publish packages step Requires trusted publisher configuration on npmjs.com for each package. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4a881d9 commit 9dd856d

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ jobs:
6060
permissions:
6161
contents: write
6262
packages: write
63+
id-token: write
6364

6465
env:
6566
PKG_VERSION: "" # will be set in the workflow
@@ -71,6 +72,7 @@ jobs:
7172
with:
7273
node-version: 22.x
7374
cache: "npm"
75+
registry-url: 'https://registry.npmjs.org'
7476
scope: '@actions'
7577

7678
- name: Parse version from lerna.json
@@ -97,13 +99,6 @@ jobs:
9799
core.summary.addLink(`Release v${{ env.PKG_VERSION }}`, release.data.html_url);
98100
await core.summary.write();
99101
100-
- name: setup authentication
101-
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
102-
env:
103-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
104-
105102
- name: Publish packages
106103
run: |
107-
lerna publish ${{ env.PKG_VERSION }} --yes --no-git-reset --no-git-tag-version
108-
env:
109-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
104+
lerna publish ${{ env.PKG_VERSION }} --yes --no-git-reset --no-git-tag-version

0 commit comments

Comments
 (0)