Skip to content

chore: pass the release version through and infer the npm tag - #5149

Merged
Doberjohn merged 1 commit into
mainfrom
chore/release-config
Oct 29, 2026
Merged

Doberjohn merged 1 commit into
mainfrom
chore/release-config

Conversation

@Doberjohn

Copy link
Copy Markdown
Collaborator

Motivation

Today yarn release 6.0.0-alpha.1 publishes 6.0.0 under the alpha npm tag. Two things combine:

  • package.json runs release-it --only-version. release-it 13.7.2 (the version in yarn.lock) has no --only-version option and parses only --dry-run and --ci as boolean flags, so the version you type becomes that flag's value and is dropped. release-it then applies the recommended bump, which is major: 6.0.0-alpha.0 becomes 6.0.0.
  • .release-it.json pins npm.tag to alpha and github.preRelease to true. A configured tag always wins, so beta, rc and 6.0.0 itself would all go to alpha as GitHub prereleases, and latest would stay on 5.15.3.

npm never accepts the same version twice, so one wrong run would burn 6.0.0. This blocks the next prerelease, 6.0.0-alpha.1.

Changes

  • package.json: the release script is plain release-it, so the version you pass is the version released.
  • .release-it.json: no npm.tag and no github.preRelease. release-it takes the npm tag from the prerelease id (alpha, beta, rc), uses latest for a stable version, and marks prereleases on GitHub by itself. github.draft: true creates the GitHub release as a draft, so publish-example-app.yml (which runs on release: published) waits until npm has the package.
  • CONTRIBUTING.md: "Publishing a release" now says to always pass the version, start with a dry run, be logged in to npm (npm whoami, else npm login), and publish the draft release once npm has the package.

Test plan

Dry runs with release-it 13.7.2 on main at eb4fcbe, with --npm.skipChecks --github.skipChecks and nothing published:

Command Before After
yarn release 6.0.0-alpha.1 --dry-run 6.0.0, npm publish --tag alpha 6.0.0-alpha.1, --tag alpha
yarn release 6.0.0-beta.0 --dry-run 6.0.0, --tag alpha 6.0.0-beta.0, --tag beta
yarn release 6.0.0 --dry-run 6.0.0, --tag alpha 6.0.0, --tag latest

With the new config, the GitHub release for 6.0.0-alpha.1 is a draft prerelease and the one for 6.0.0 a draft regular release.

The 5.0 branch is not affected: its release script is already plain release-it and it sets no npm tag. Before any 5.x release after 6.0.0 it will need "tag": "5.x", in a separate PR to 5.0.

The release script ran `release-it --only-version`. release-it 13.7.2 has
no such option and parses only --dry-run and --ci as boolean flags, so
`yarn release 6.0.0-alpha.1` took the version as the flag's value and
released the recommended bump instead: 6.0.0.

.release-it.json pinned npm.tag to "alpha" and github.preRelease to true.
A configured tag always wins, so every release, 6.0.0 included, would go
to the alpha tag as a GitHub prerelease and leave 5.15.3 on latest.

- Run plain `release-it`, so the version passed is the version released.
- Drop npm.tag and github.preRelease: release-it takes the tag from the
  prerelease id (alpha, beta, rc) or uses latest for a stable version,
  and marks prereleases on GitHub by itself.
- Create the GitHub release as a draft, so the example app pipeline
  (which runs when a release is published) waits until npm has the
  package.
- Rewrite "Publishing a release" in CONTRIBUTING.md to match.
@github-actions

Copy link
Copy Markdown

Found potential problems with the pull request:

  • The description is too long. Please keep it under 1000 characters.
  • Screenshot or video evidence is missing. Make sure to include one if it affects the UI.

@Doberjohn
Doberjohn merged commit 56c907a into main Oct 29, 2026
14 of 15 checks passed
@Doberjohn
Doberjohn deleted the chore/release-config branch October 29, 2026 14:53
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