diff --git a/cli/internal/recipe.go b/cli/internal/recipe.go index b4f01020..ede34464 100644 --- a/cli/internal/recipe.go +++ b/cli/internal/recipe.go @@ -11,7 +11,7 @@ import ( ) // PromptBumpType prompts for version bump type -func PromptBumpType(tagString string) error { +func PromptBumpType(tagString, latestRelease string) error { if (!Major && !Minor && !Patch) && tagString == "" { fmt.Printf(` You need to make a decision about what kind of an update this new recipe @@ -20,6 +20,8 @@ migration work or take care of some breaking changes? This can be signaled in the version you specify on the recipe deploy label and is called a semantic version. +The latest published version is %s. + Here is a semver cheat sheet (more on https://semver.org): major: new features/bug fixes, backwards incompatible (e.g 1.0.0 -> 2.0.0). @@ -34,7 +36,7 @@ Here is a semver cheat sheet (more on https://semver.org): should also Just Work and is mostly to do with minor bug fixes and/or security patches. "nothing to worry about". -`) +`, latestRelease) var chosenBumpType string prompt := &survey.Select{ diff --git a/cli/recipe/release.go b/cli/recipe/release.go index 05481f2e..79c72d10 100644 --- a/cli/recipe/release.go +++ b/cli/recipe/release.go @@ -322,12 +322,6 @@ func createReleaseFromPreviousTag(tagString, mainAppVersion string, recipe recip } var lastGitTag tagcmp.Tag - if tagString == "" { - if err := internal.PromptBumpType(tagString); err != nil { - return err - } - } - for _, tag := range tags { parsed, err := tagcmp.Parse(tag) if err != nil { @@ -368,6 +362,12 @@ func createReleaseFromPreviousTag(tagString, mainAppVersion string, recipe recip newTag.Major = strconv.Itoa(now + 1) } + if tagString == "" { + if err := internal.PromptBumpType(tagString, lastGitTag.String()); err != nil { + return err + } + } + if internal.Major || internal.Minor || internal.Patch { newTag.Metadata = mainAppVersion tagString = newTag.String() diff --git a/cli/recipe/sync.go b/cli/recipe/sync.go index 74d67c56..fd6f1af2 100644 --- a/cli/recipe/sync.go +++ b/cli/recipe/sync.go @@ -95,7 +95,8 @@ likely to change. } if nextTag == "" && (!internal.Major && !internal.Minor && !internal.Patch) { - if err := internal.PromptBumpType(""); err != nil { + latestRelease := tags[len(tags)-1] + if err := internal.PromptBumpType("", latestRelease); err != nil { logrus.Fatal(err) } }