improve versioning by verifying it is greater

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2025-01-05 17:35:21 -06:00
parent 6d0503b9e5
commit 439067b9ac
1 changed files with 16 additions and 2 deletions

View File

@ -1,6 +1,9 @@
package main
import (
"os"
"strings"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
@ -36,10 +39,21 @@ func forceReleaseVersion(repo *gitpb.Repo) {
repo.IncrementTargetMinor()
} else {
// if v1.2.3 change to v.1.2.4
repo.IncrementTargetRevision()
if repo.IncrementTargetRevision() {
// worked ok
} else {
log.Info("Failed to increment target revision", repo.GetFullPath())
os.Exit(-1)
}
}
// empty git notes
repo.Run([]string{"git", "notes", "remove"})
if result, err := repo.RunStrictNew([]string{"go-mod-clean", "--purge"}); err != nil {
log.Info("probably you don't have go-mod-clean")
log.Info(strings.Join(result.Stdout, "\n"))
log.Info(strings.Join(result.Stderr, "\n"))
repo.Run([]string{"git", "notes", "remove"})
os.Exit(-1)
}
if !runGoClean(repo, "--restore") {
log.Info("go-mod-clean probably failed here. that's ok", repo.GetGoPath())