Skip to content

Commit

Permalink
use + rather than - for semver compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
gartnera committed Nov 14, 2024
1 parent d1182f7 commit 09d0aaf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions app/setup_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/zetacored/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Check failure on line 14 in cmd/zetacored/version.go

View workflow job for this annotation

GitHub Actions / lint

unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive)
fmt.Println(app.GetDefaultUpgradeHandlerVersion())
},
Expand Down
4 changes: 2 additions & 2 deletions version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
echo "0.0.${commit_timestamp}+${short_commit}"

0 comments on commit 09d0aaf

Please sign in to comment.