Skip to content

fix(release): pass --tag next when publishing a pre-release#481

Merged
Luis85 merged 1 commit into
mainfrom
fix/release-prerelease-npm-tag
May 10, 2026
Merged

fix(release): pass --tag next when publishing a pre-release#481
Luis85 merged 1 commit into
mainfrom
fix/release-prerelease-npm-tag

Conversation

@Luis85
Copy link
Copy Markdown
Owner

@Luis85 Luis85 commented May 10, 2026

Summary

The v0.8.0-rc.1 dispatch (run 25640431367) reached the npm publish step and failed with:

```
npm error You must specify a tag using --tag when publishing a prerelease version.
```

`npm publish` refuses to default a semver prerelease (`-rc.1`) to the `latest` dist-tag because that would silently demote stable consumers who pin `latest`. Without `--tag`, prereleases fail closed.

Parametrise the publish step on `inputs.prerelease`:

prerelease publish args
`true` `npm publish --provenance --tag next `
`false` `npm publish --provenance ` (defaults to `latest`)

What the failed dispatch confirmed

Every gate before npm CLI ran green:

  • Layer 1 readiness ✓
  • Build claude-plugin in workflow ✓
  • Layer 2 readiness ✓
  • Confirm gate ✓
  • Tarball provenance attestation ✓
  • GitHub Release create (with asset upload) ✓
  • npm publish CLI argument validation ✗ — this PR's fix

So the npmjs.com Trusted Publishing config and the OIDC token-mint path are reachable end-to-end. This fix unblocks the last gate before OIDC auth actually runs.

Test plan

  • `npx vitest run tests/scripts/release-readiness.test.ts` — 36/36 pass.
  • CI green on this PR.
  • Post-merge: force-move `v0.8.0-rc.1` tag forward to new main HEAD, re-dispatch `release.yml --ref v0.8.0-rc.1 -f version=0.8.0-rc.1 -f prerelease=true -f publish_package=true -f dry_run=false -f confirm=0.8.0-rc.1`.
  • Verify post-publish:
    ```
    npm view specorator@0.8.0-rc.1 --json | jq '{version: .version, attestations: .dist.attestations, dist_tags: ._npmUser}'
    npm view specorator dist-tags --json # should show "next": "0.8.0-rc.1", "latest" unchanged at "0.7.0"
    ```

Idempotency on re-dispatch

The previous failed dispatch created the `v0.8.0-rc.1` GitHub Release with the candidate tarball asset attached. The re-dispatch will hit the workflow's "promote in place" branch (step 9a):

  • Detect existing Release → skip create.
  • Asset already attached → skip upload (avoids clobber-then-fail data loss path).
  • `gh release edit --draft=false --prerelease=true` → flag flip (no-op since current flags match).
  • Proceed to npm publish step with `--tag next`.

🤖 Generated with Claude Code

The v0.8.0-rc.1 dispatch (run 25640431367, second attempt) failed at the
Publish step with:

  npm error You must specify a tag using --tag when publishing a
  prerelease version.

`npm publish` refuses to default a semver prerelease (`-rc.1`) to the
`latest` dist-tag because that would silently demote stable consumers
who pin `latest`. Without `--tag`, prereleases fail closed.

Parameterise the publish step on `inputs.prerelease`:

- prerelease=true  → `npm publish --provenance --tag next <tarball>`
- prerelease=false → `npm publish --provenance <tarball>` (defaults to
                     `latest`)

This is workflow plumbing — every other step (Layer 1+2 readiness,
build:claude-plugin, tarball provenance attestation, Release create
with asset upload) succeeded on the previous dispatch, so the
Trusted-Publishing config on npmjs.com is reachable end-to-end. This
fix unblocks the last gate before the OIDC publish actually runs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Luis85 Luis85 merged commit 4b73844 into main May 10, 2026
12 checks passed
@Luis85 Luis85 deleted the fix/release-prerelease-npm-tag branch May 10, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants