Skip to content

Commit 78b90cb

Browse files
committed
Publish to npm through trusted publishing
The publish job authenticates with the job's OpenID Connect token via the package's trusted publisher configuration on npmjs.com instead of a stored npm token, so the NPM_AUTH_TOKEN secret is no longer used. The runner's npm is updated to the current release because the OIDC flow needs npm 11.5.1 or newer. A workflow_dispatch input allows publishing an existing tag on demand. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent b7fef66 commit 78b90cb

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ on:
1010
description: Tag to publish, for example v3.1.0
1111
required: true
1212
type: string
13+
workflow_dispatch:
14+
inputs:
15+
tag:
16+
description: Tag to publish, for example v3.1.0
17+
required: true
18+
type: string
1319

1420
jobs:
1521
lint:
@@ -60,11 +66,14 @@ jobs:
6066
with:
6167
node-version: '22'
6268
registry-url: 'https://registry.npmjs.org'
69+
# Publishing authenticates with the job's OpenID Connect token through the
70+
# package's trusted publisher configuration on npmjs.com; no npm token is
71+
# stored in the repository. The OIDC flow needs npm 11.5.1 or newer.
72+
- name: Update npm
73+
run: npm install -g npm@latest
6374
- name: Install dependencies
6475
run: npm ci
6576
- name: Build
6677
run: npm run build
6778
- name: Release
6879
run: npm publish --provenance --access public
69-
env:
70-
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

0 commit comments

Comments
 (0)