Skip to content

Commit 1d96553

Browse files
authored
ci: publish to npm with the npm CLI instead of pnpm (#213)
The `4.0.0` release-please run tagged `package-v4.0.0` and created the GitHub Release, but the **publish job failed**: it built and signed provenance, then died on the upload with `404 Not Found - PUT https://registry.npmjs.org/@alchemy_cms%2fjson_api`. That is the pnpm OIDC trusted-publishing bug ([pnpm/pnpm#11513](pnpm/pnpm#11513)): pnpm generates the provenance (via sigstore, which is why that step succeeds) but does not complete the OIDC→npm auth exchange, so the tarball `PUT` goes out unauthenticated and npm returns 404. This publishes with the **npm CLI** instead — upgraded to `>= 11.5.1`, which implements trusted publishing correctly — while keeping pnpm for install/build. It also adds a `workflow_dispatch` trigger (and lets the `publish` job run on it), so the **already-tagged `4.0.0`** can be published without waiting for a new release event. After merge: run the workflow manually (Actions → Release Please → Run workflow) to publish `4.0.0`; subsequent releases publish automatically. If it still 404s with the npm CLI, the npmjs **trusted publisher** registration doesn't match — verify it targets repo `AlchemyCMS/alchemy-json_api` and workflow file `release-please.yml`.
2 parents da65428 + 901e6aa commit 1d96553

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎.github/workflows/release-please.yml‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
workflow_dispatch:
78

89
permissions:
910
contents: write
@@ -23,7 +24,7 @@ jobs:
2324

2425
publish:
2526
needs: release-please
26-
if: needs.release-please.outputs.release_created == 'true'
27+
if: ${{ needs.release-please.outputs.release_created == 'true' || github.event_name == 'workflow_dispatch' }}
2728
runs-on: ubuntu-latest
2829
permissions:
2930
contents: read
@@ -38,11 +39,18 @@ jobs:
3839
with:
3940
node-version: "22"
4041
registry-url: "https://registry.npmjs.org"
42+
# pnpm's OIDC trusted-publishing handshake is broken (pnpm/pnpm#11513),
43+
# so publish with the npm CLI, which needs >= 11.5.1 for trusted publishing.
44+
- name: Update npm for OIDC trusted publishing
45+
run: npm install --global npm@latest
4146
- name: Install pnpm
4247
uses: pnpm/action-setup@v4
4348
with:
4449
version: 10.12.1
4550
- name: Install dependencies
4651
run: pnpm install
52+
- name: Build
53+
run: pnpm run build
54+
# pnpm builds; npm only uploads (--ignore-scripts skips the prepare rebuild).
4755
- name: Publish to npm with provenance
48-
run: pnpm publish --provenance --access public --no-git-checks
56+
run: npm publish --provenance --access public --ignore-scripts

0 commit comments

Comments
 (0)