Commit 3748941
fix(release): skip past orphaned version bumps in patch-release flow (tldraw#8838)
In order to recover from a previously-interrupted patch release that
wedges a release branch's CI, this PR makes the patch-release script
bump from `max(latestPublishedVersion, localTldrawVersion)` instead of
always from the latest version on npm. Follow-up to tldraw#8800.
[The `v4.0.x` patch-release run on the test
commit](https://github.com/tldraw/tldraw/actions/runs/25747452078/job/75614452558)
got past the diff-check fix from tldraw#8800 but then died at:
```
→ No staged files found.
cmd: 'git commit -m v4.0.4 [skip ci]'
```
That branch is in this state:
- npm `tldraw` latest = `4.0.3`
- Local `package.json`s already say `4.0.4` (from the orphaned `2293cc1a
v4.0.4 [skip ci]` commit on `v4.0.x`)
- Tag `v4.0.4` already exists on origin pointing at that orphaned commit
So when the script tried to bump npm's `4.0.3` → `4.0.4` and call
`setAllVersions("4.0.4")`, every package.json was already at `4.0.4`,
nothing was staged, and `git commit` exited 1. Even with that fixed, the
next step (`git push --follow-tags`) would have failed because `v4.0.4`
already exists on origin at a different commit.
### Fix
Compute the bump base as the higher of (latest npm version, local
`tldraw` version):
- **Happy path** (local equals npm): identical to today - bump from
npm's latest, behaviour unchanged.
- **Broken-state path** (local ahead of npm): bump from the local
version, which leapfrogs past the orphaned version+tag entirely. For
`v4.0.x` that means publishing `4.0.5` instead of trying to re-create
`4.0.4`. Both `git commit` (real changes from `4.0.4` -> `4.0.5`) and
`git push --follow-tags` (fresh tag) work normally.
Logs a notice when the leapfrog path is taken, so it's obvious in CI
output what's happening.
The `prevTag` used for changelog generation still points at the actual
latest npm version (e.g. `v4.0.3`), so the GitHub release notes still
cover all commits since the real previous release.
### Change type
- [x] `bugfix`
### Test plan
1. Push to `v4.0.x` again - the workflow should publish `4.0.5`
successfully (4.0.4 stays orphaned on the abandoned commit, which is
fine).
2. Confirm normal release branches (`v4.5.x`, etc.) bump as before. In
the steady state where local equals npm, `baseVersion ===
latestVersionInBranch` and `nextVersion` is still `latest + 1 patch`.
### Code changes
| Section | LOC change |
| --------------- | ---------- |
| Config/tooling | +28 / -2 |
Made with [Cursor](https://cursor.com)
---------
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent f9a046b commit 3748941
2 files changed
Lines changed: 29 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
70 | 96 | | |
71 | 97 | | |
72 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
0 commit comments