Refuse to release a version older than the last one - #13
Merged
Conversation
Nothing caught it. 0.0.9 after 0.1.1 is valid semver, is not a snapshot, and has no tag, so all four existing checks passed it -- and publishing to Central is the irreversible half. Two deliberate looseness choices, both to avoid half-implementing semver precedence in bash. Only the numeric core is compared, and only for "not older" rather than "strictly newer". The second is what lets 1.0.0 follow 1.0.0-rc1, which a strict-greater check would wrongly block; an exact repeat is already refused by the tag check above it. The residual gap is 1.0.0-rc2 after 1.0.0, which is rare and ambiguous enough not to be worth the machinery. Field-wise numeric sort rather than sort -V, which is not portable and orders pre-release versions wrongly anyway. Tested: 0.1.11 and 10.0.0 are correctly newer than 0.1.1, which lexicographic comparison gets backwards. The version input stays. It guards a different failure mode -- main not being where you think, in either direction -- which a monotonicity check does not subsume: if you believe main is on 0.1.2 and someone merged 0.2.0, this check passes and 0.2.0 ships. It is also what run-name reads to title the run, and run-name is evaluated before any job so it cannot read gradle.properties. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
0.0.9after0.1.1currently releases cleanly: it is valid semver, is not a-SNAPSHOT, andv0.0.9does not exist, so all four checks in "Check the version" pass it. Publishing to Centralis the irreversible half, so that is worth closing.
The comparison
Two deliberate looseness choices, both to avoid half-implementing semver precedence in bash:
1.0.0-rc1is compared as1.0.0.1.0.0follow1.0.0-rc1,which a strict-greater check would wrongly block. An exact repeat is already refused by the
tag-exists check immediately above.
Residual gap:
1.0.0-rc2after1.0.0is allowed. Rare and ambiguous enough not to be worth themachinery.
Field-wise numeric sort (
sort -t. -k1,1n -k2,2n -k3,3n) rather thansort -V, which is notportable across GNU and BSD and orders pre-release versions wrongly regardless.
Tested
v0.1.0 v0.1.10.1.2,0.2.0,1.0.0v0.1.0 v0.1.10.0.9,0.1.0v0.1.0 v0.1.10.1.11,10.0.0v0.1.0 v0.1.10.1.1… v1.0.0-rc11.0.0Why the input stays
It guards a different failure mode, so the new check does not subsume it:
requested == committedIf you believe main is on 0.1.2 and someone merged 0.2.0, monotonicity passes and 0.2.0 ships.
It is also what
run-namereads.run-nameis evaluated before any job starts and can only usethe
github,inputsandvarscontexts, so it cannot readgradle.properties— dropping theinput would put the Actions list back to a column of identical "Release" entries, which is what #8
was merged to fix.
Ordering
Independent of #11 and #12; touches a different region of
release.ymlthan #12 does.