fix: stop rewriting dev during release publish#22982
Draft
kitlangton wants to merge 1 commit intodevfrom
Draft
Conversation
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.
Summary
This fixes the release workflow bug where a long-running manual release can silently drop already-merged commits from
dev.The old flow created the release commit on a stale checkout, then tried to reconcile by cherry-picking everything merged during the build window on top of that release commit and force-pushing the result:
If the cherry-pick stopped on a conflict or empty commit,
.nothrow()swallowed the failure and the script force-pushed an incomplete branch. That's how #22926 and #22944 got dropped fromdevafter thev1.4.7release.New flow
This PR switches
script/publish.tsto a two-phase model:Release/tag commit
release: vX.Y.Zcommit there.Dev sync commit
origin/dev.dev.dev.sync release versions for vX.Y.Zcommit and fast-forward push it.This keeps the semantics we want:
devwith their original SHAs.devstill ends with the release version bump, but we append it as a fresh commit instead of rewriting history to insert it earlier.devcommits.dev.Extra change
script/version.tsnow creates draft releases with--target ${GITHUB_SHA}so the draft tag/release is explicitly anchored to the workflow kickoff commit instead of whatever happens to be the latest default-branch commit at that moment.Trade-offs
This does intentionally create two version-bump commits during a release:
devsync commitThat is a little ugly, but it preserves the two things we need simultaneously:
devmust preserve all later merged PRs without rewriting historyVerification
bun run lint script/publish.ts script/version.tsbun turbo typecheck