build: improve next version calculation for bumped prereleases

This commit is contained in:
Jakob Borg
2025-07-06 20:56:56 +02:00
parent 7c07610ab2
commit e8cfc8acfb
+8 -3
View File
@@ -82,9 +82,14 @@ func main() {
} }
// We want the next prerelease. We are already on a prerelease. If // We want the next prerelease. We are already on a prerelease. If
// it's the correct prerelease compared to the logs we just got, we // it's the correct prerelease compared to the logs we just got, or
// should just bump the prerelease counter. // newer, we should just bump the prerelease counter. We compare
if next.Major == latest.Major && next.Minor == latest.Minor && next.Patch == latest.Patch { // against the latest without the prerelease part, as otherwise it
// would compare less than next if they represent the same version
// -- pre being less than stable.
latestNoPre := *latest
latestNoPre.PreRelease = ""
if !latestNoPre.LessThan(next) {
parts := latest.PreRelease.Slice() parts := latest.PreRelease.Slice()
for i, p := range parts { for i, p := range parts {
if v, err := strconv.Atoi(p); err == nil { if v, err := strconv.Atoi(p); err == nil {