From 09d0aafa06e2abc344aae166d2811960ff01eb7e Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Thu, 14 Nov 2024 09:22:44 -0800 Subject: [PATCH] use + rather than - for semver compliance --- app/setup_handlers.go | 7 +++++-- cmd/zetacored/version.go | 2 +- version.sh | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/setup_handlers.go b/app/setup_handlers.go index 7b609523e9..9088f5c8df 100644 --- a/app/setup_handlers.go +++ b/app/setup_handlers.go @@ -17,13 +17,16 @@ import ( // There may be multiple upgrade handlers configured on some releases if different // migrations needto be run in different environment func GetDefaultUpgradeHandlerVersion() string { + // semver must have v prefix, but we store without prefix + vVersion := "v" + constant.Version + // development builds always use the full version in the release handlers - if semver.Build(constant.Version) != "" || semver.Prerelease(constant.Version) != "" { + if semver.Build(vVersion) != "" || semver.Prerelease(vVersion) != "" { return constant.Version } // release builds use just the major version (v22.0.0 -> v22) - return semver.Major(constant.Version) + return semver.Major(vVersion) } func SetupHandlers(app *App) { diff --git a/cmd/zetacored/version.go b/cmd/zetacored/version.go index 18555a5fa3..c5f2d5d277 100644 --- a/cmd/zetacored/version.go +++ b/cmd/zetacored/version.go @@ -10,7 +10,7 @@ import ( func UpgradeHandlerVersionCmd() *cobra.Command { return &cobra.Command{ Use: "upgrade-handler-version", - Short: "Print the upgrade handler version", + Short: "Print the default upgrade handler version", Run: func(cmd *cobra.Command, args []string) { fmt.Println(app.GetDefaultUpgradeHandlerVersion()) }, diff --git a/version.sh b/version.sh index aedbfa5eeb..862d295ab9 100755 --- a/version.sh +++ b/version.sh @@ -22,8 +22,8 @@ short_commit=$(git rev-parse --short HEAD) # append -dirty for dirty builds if ! git diff --no-ext-diff --quiet --exit-code ; then - echo "0.0.${commit_timestamp}-${short_commit}-dirty" + echo "0.0.${commit_timestamp}+${short_commit}-dirty" exit fi -echo "0.0.${commit_timestamp}-${short_commit}" \ No newline at end of file +echo "0.0.${commit_timestamp}+${short_commit}" \ No newline at end of file