fix(ci): follow higher prerelease line when one already exists#1308
Conversation
If a prerelease for a version above the stable-bump target exists (e.g. v0.14.0b1 already published but latest_stable=v0.13.2 → patch bump would give v0.13.3), the workflow now detects the higher prerelease and continues that release line (v0.14.0b2) instead of creating a stale v0.13.3b1. Fixes ActivityWatch#1307
Greptile SummaryThis PR fixes a bug in the
Confidence Score: 4/5Safe to merge; the fix correctly redirects the scheduler to continue an in-flight minor/patch prerelease line rather than creating a stale lower one. The bash logic handles the primary scenario and all edge cases: hp_base < next_base (no override), hp_base == next_base (equality guard prevents override), hp_base > next_base (override then falls into existing last-prerelease search). The sort -V comparison and git tag --sort=-version:refname both agree on version ordering for standard semver-style tags. A stale prerelease tag whose base has since been stabilized will never be picked up because hp_base would then be less than or equal to the new next_base. The score reflects modest risk from touching release-tagging automation. No files require special attention; the only changed file is the preflight step of the CI workflow. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Get latest_stable tag] --> B[bump_version → next_base]
B --> C{highest_prerelease\nexists?}
C -- No --> E
C -- Yes --> D{hp_base >\nnext_base?}
D -- No --> E[prerelease_pattern for next_base]
D -- Yes --> F[Override: next_base = hp_base]
F --> E
E --> G{last_prerelease\nfor next_base?}
G -- Yes --> H[since_ref = last_prerelease\nnext_tag = vNb+1]
G -- No --> I[since_ref = latest_stable\nnext_tag = vNb1]
H --> J[commits_since_ref == 0?]
I --> J
J -- Yes → skip --> K[should_release=false]
J -- No → CI OK --> L[should_release=true, push next_tag]
Reviews (1): Last reviewed commit: "fix(ci): follow higher prerelease line w..." | Re-trigger Greptile |
|
This PR is ready for merge:
The 4/5 score reflects general caution about release automation, not a specific code issue. No inline feedback to address. @ErikBjare, this just needs your merge. |
Problem
The
dev-releaseworkflow computesnext_baseby bumpinglatest_stableby the configuredRELEASE_LINE(defaulting topatch). It then looks for existing prereleases matching that specific version. But it never checks whether a prerelease for a newer version already exists.Concretely:
latest_stable = v0.13.2,RELEASE_LINE = patch→next_base = 0.13.3. The workflow only looks forv0.13.3bNtags, ignoring thatv0.14.0b1already existed. This caused the scheduled run to draftv0.13.3b1andv0.13.3b2— stale patch prereleases behind the already-in-flight minor release line.Fixes #1307.
Fix
After computing
next_base, find the highest existing prerelease tag across all versions. If it's for a version newer thannext_base, use that version's base instead — continuing the in-flight release line rather than starting a stale one.Test plan
v0.13.2+v0.14.0b1, run the script withRELEASE_LINE=patch—next_tagshould bev0.14.0b2workflow_dispatchto confirm it producesv0.14.0b2nextv0.13.3b1/v0.13.3b2draft releases that were incorrectly created