Skip to content

Commit f4915fd

Browse files
committed
ci(npm): combine upgrade+publish in one step + OIDC diagnostics
ENEEDAUTH means npm never attempted OIDC (almost always npm < 11.5.1 at publish time, or id-token unavailable). Run upgrade+publish in one step so publish uses the upgraded npm, and print npm -v + whether the OIDC id-token is present.
1 parent 1356747 commit f4915fd

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

.github/workflows/publish-npm.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,20 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v4
1818

19-
# NOTE: do NOT set registry-url here — it writes an .npmrc with an
20-
# (empty) _authToken that shadows OIDC trusted publishing.
19+
# No registry-url — it writes an .npmrc whose empty _authToken shadows OIDC.
2120
- uses: actions/setup-node@v4
2221
with:
2322
node-version: "22"
2423

25-
- name: Upgrade npm (trusted publishing needs >= 11.5.1)
24+
# Upgrade + publish in ONE step so the publish definitely uses the new npm
25+
# (trusted publishing needs npm >= 11.5.1). Diagnostics confirm the setup.
26+
- name: Publish to npm (OIDC trusted publishing)
2627
run: |
2728
npm install -g npm@latest
28-
npm -v
29-
30-
# OIDC trusted publishing — no token, no .npmrc. Provenance is automatic.
31-
- name: Publish to npm
32-
run: npm publish
29+
echo "npm version: $(npm -v)"
30+
if [ -n "$ACTIONS_ID_TOKEN_REQUEST_URL" ]; then
31+
echo "OIDC: id-token IS available"
32+
else
33+
echo "OIDC: id-token MISSING — check 'id-token: write' and repo Actions settings"
34+
fi
35+
npm publish

0 commit comments

Comments
 (0)