Skip to content

Commit 820d2d2

Browse files
Snailedltclaude
andcommitted
ci: publish to npm with trusted publishing (OIDC)
The v2.18.0 publish failed with E404 because npm rejected the NPM_AUTOMATION_TOKEN. Authenticate through the trusted publisher configured on npmjs.com instead, and add workflow_dispatch so a failed publish can be re-run by hand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent ff435a0 commit 820d2d2

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

‎.github/workflows/npm_publish.yml‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: "Publish to npm"
22
on:
33
release:
44
types: [released]
5+
# Allows re-running a failed publish by hand from the Actions tab
6+
workflow_dispatch:
7+
permissions:
8+
id-token: write # Required for npm trusted publishing (OIDC)
9+
contents: read
510
jobs:
611
publish:
712
environment: release
@@ -11,13 +16,15 @@ jobs:
1116
with:
1217
# "ref" specifies the branch to check out.
1318
# "github.event.release.target_commitish" is a global variable and specifies the branch the release targeted
19+
# It's empty on manual runs, so the branch selected in the Actions tab is used instead
1420
ref: ${{ github.event.release.target_commitish }}
15-
- name: Use Node.js v16
21+
- name: Use Node.js v24
1622
uses: actions/setup-node@v4
1723
with:
1824
node-version: 24
1925
registry-url: https://registry.npmjs.org/ # Specifies the registry, this field is required!
26+
# Trusted publishing requires npm 11.5.1 or later
27+
- run: npm install -g npm@latest
2028
- run: npm ci
29+
# Authenticates through the trusted publisher configured on npmjs.com, so no token is needed
2130
- run: npm publish
22-
env:
23-
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTOMATION_TOKEN }}

0 commit comments

Comments
 (0)