Skip to content

Commit

Permalink
🔧 add major version bump capability to version tools (#2960)
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Richter <[email protected]>
  • Loading branch information
arlimus authored Jan 7, 2024
1 parent 59f7bb8 commit 9f90c0b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions providers-sdk/v1/util/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,16 +432,19 @@ func bumpVersion(version string) (string, error) {

patch := v.IncPatch()
minor := v.IncMinor()
// TODO: check if the major version of the repo has changed and bump it
major := v.IncMajor()

if increment == "patch" {
return (&patch).String(), nil
}
if increment == "minor" {
return (&minor).String(), nil
}
if increment == "major" {
return (&major).String(), nil
}
if increment != "" {
return "", errors.New("do not understand --increment=" + increment + ", either pick patch or minor")
return "", errors.New("do not understand --increment=" + increment + ", either pick patch, minor, or major")
}

versions := []string{
Expand Down Expand Up @@ -660,7 +663,7 @@ var (
func init() {
rootCmd.PersistentFlags().BoolVar(&fastMode, "fast", false, "perform fast checking of git repo (not counting changes)")
rootCmd.PersistentFlags().BoolVar(&doCommit, "commit", false, "commit the change to git if there is a version bump")
rootCmd.PersistentFlags().StringVar(&increment, "increment", "", "automatically bump either patch or minor version")
rootCmd.PersistentFlags().StringVar(&increment, "increment", "", "automatically bump either patch, minor, or major version")

modUpdateCmd.PersistentFlags().BoolVar(&latestVersion, "latest", false, "update versions to latest")
modUpdateCmd.PersistentFlags().BoolVar(&latestPatchVersion, "patch", false, "update versions to latest patch")
Expand Down

0 comments on commit 9f90c0b

Please sign in to comment.