fix(release): derive the version without lerna's dry run - #34
Merged
Merged
Conversation
Dispatching a release without a version fails. Preflight derives the bump by running `lerna version --conventional-commits --dry-run` and reading the version back out of the output, and lerna 10 rejects that flag outright: "Unknown arguments: dry-run, dryRun". The bump to lerna 10 landed two days ago. It has never bitten anyone, because it has never been used: the 2.13.0 release passed its version explicitly, so the derive path the input description recommends has not run in a real release. Ask conventional-recommended-bump for the release type and apply it to the workspace version. That is the library lerna drives for this, with the preset lerna.json names, so it reaches the answer lerna would have reached, and it is now a direct devDependency rather than something borrowed from lerna's own tree. The binary is invoked by path, so a missing dependency fails in preflight instead of being fetched from the network in the middle of a release. Nothing recomputes the number afterwards -- the version job passes the resolved value to `lerna version` explicitly -- so preflight stays the single place the version is decided.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dispatching the Release workflow without a version currently fails. This fixes that.
The bug
scripts/release-preflight.shderives the version by running lerna and reading the result back out of its output:lerna 10 rejects that flag:
Unknown arguments: dry-run, dryRun. So preflight exits 1 with "Could not read a single stable version out of lerna's dry run", and the release stops before it starts.The lerna 9 → 10 bump landed in #32 two days ago. The removal is not in lerna's documented breaking changes for 10.0.0, and
lerna publish --dry-runstill works, so it looks unintentional on their side — but it is real either way.It has never bitten anyone, because the derive path has never been used. The 2.13.0 release passed
REQUESTED_VERSION: 2.13.0explicitly. The workflow input still tells you "Leave empty to derive it from the conventional commits", which has been advice that would fail.The fix
Ask
conventional-recommended-bumpfor the release type and apply it to the workspace version. That is the library lerna drives to compute this, invoked with the presetlerna.jsonnames, so it reaches the answer lerna would have reached — verified against the tag boundary rather than assumed: the repository has 46featcommits in its history and none sincev2.13.0, and the tool reportspatch, withReason: There are 0 BREAKING CHANGES and 0 features.Two deliberate details:
=12.1.0, the version lerna already resolves, rather than being borrowed from lerna's tree. A release-critical script should not depend on a transitive that a future lerna could drop. No new package enters the tree; the lockfile moves by one line.npx, so a missing dependency fails in preflight rather than being fetched from the network in the middle of a release.Nothing recomputes the number afterwards. The version job receives the resolved value and passes it to
lerna versionexplicitly, so preflight remains the single place the version is decided and the two cannot diverge.Verification
Both modes, run against the real repository state:
version=2.14.0The guards were re-tested, since this script gates a job that can write to
mainand publish to the registry:2.14.0-rc.1(prerelease)^2.14.0(range)2.13.0(does not move forward / already published)2.12.0(backwards)2.14.0; echo pwned(shell metacharacters)2.13.1,2.14.0And the new failure mode: with
node_modules/.bin/conventional-recommended-bumpremoved, preflight aborts with a clear "No such file or directory" rather than reaching for the network.bash -npasses;npm testis 400 passing andnpm auditclean, though neither touches this script.Not covered here
Two other things changed under the release pipeline since its last successful run on 2026-09-09, both flagged rather than fixed:
actions/upload-artifactwent 4 → 7 in chore(deps): bump actions/upload-artifact from 4 to 7 #30 and appears only inrelease.yml, so no CI job exercises it. The next release is its first real run.EBEHINDin CI when the checkout is behind the remote, where that previously only happened locally.command.version.ciBehindBehaviorinlerna.jsonis the opt-out if it becomes a problem.