Commit 342b665
committed
fix(_publish-npm): make the corepack npm upgrade actually take effect
`corepack prepare npm@latest --activate` only records the version in
COREPACK_HOME. It does not put that npm on PATH, so `npm` keeps
resolving to the runner's bundled copy and the upgrade silently
no-ops - the step still prints a reassuring "Updated npm version" line
and exits 0.
Observed on Zondax/ledger-filecoin-js v3.0.10, the first release to run
this workflow at @v11:
Current npm version: 10.9.8
Updated npm version: 10.9.8
...
NODE_AUTH_TOKEN: XXXXX-XXXXX-XXXXX-XXXXX
npm http fetch PUT 404 https://registry.npmjs.org/@zondax%2fledger-filecoin
npm error 404 '@zondax/ledger-filecoin@3.0.10' is not in this registry.
npm 10.9.8 predates OIDC trusted publishing, so rather than exchanging
the OIDC token it authenticated with the placeholder _authToken that
setup-node writes into .npmrc, and the registry reported the
unauthorized publish as a misleading E404. Provenance still signed
correctly in that run, which is why the failure looks like a
trusted-publisher misconfiguration rather than a stale npm.
Reproduced locally, independent of CI:
baseline npm 11.5.2
after `corepack prepare --activate` 11.5.2 <- no-op
after `corepack enable npm` + prepare 12.0.2
Two changes:
- run `corepack enable npm` before `corepack prepare`, so the shim that
routes `npm` through corepack is actually installed
- assert npm >= 11.5.1 afterwards and fail the job if not
The assertion matters as much as the fix. The v11 regression shipped
because dry-run mode skips the publish step entirely, so every consumer
PR went green while the real release path was broken. The guard runs on
dry-run too, which turns this class of failure into a red PR instead of
a failed release.1 parent be94afd commit 342b665
1 file changed
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
126 | 132 | | |
127 | 133 | | |
| 134 | + | |
128 | 135 | | |
129 | 136 | | |
130 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
131 | 149 | | |
132 | 150 | | |
133 | 151 | | |
| |||
0 commit comments