diff --git a/cli/recipe/release.go b/cli/recipe/release.go index efa46069..20c19e73 100644 --- a/cli/recipe/release.go +++ b/cli/recipe/release.go @@ -198,7 +198,9 @@ func createReleaseFromTag(recipe recipe.Recipe, tagString, mainAppVersion string logrus.Fatal(err) } - tagString = fmt.Sprintf("%s+%s", tag.String(), mainAppVersion) + if tagString == "" { + tagString = fmt.Sprintf("%s+%s", tag.String(), mainAppVersion) + } if err := tagRelease(tagString, repo); err != nil { logrus.Fatal(err) @@ -252,7 +254,7 @@ func commitRelease(recipe recipe.Recipe) error { } } - if internal.CommitMessage == "" && !internal.NoInput { + if internal.CommitMessage == "" && !internal.NoInput && internal.Commit { prompt := &survey.Input{ Message: "commit message", Default: "chore: publish new %s version", @@ -274,7 +276,7 @@ func commitRelease(recipe recipe.Recipe) error { func tagRelease(tagString string, repo *git.Repository) error { if internal.Dry { - logrus.Info("dry run: no git tag created") + logrus.Infof("dry run: no git tag created (%s)", tagString) return nil } @@ -335,7 +337,7 @@ func createReleaseFromPreviousTag(tagString, mainAppVersion string, recipe recip bumpType := btoi(internal.Major)*4 + btoi(internal.Minor)*2 + btoi(internal.Patch) if bumpType != 0 { if (bumpType & (bumpType - 1)) != 0 { - fmt.Errorf("you can only use one of: --major, --minor, --patch.") + return fmt.Errorf("you can only use one of: --major, --minor, --patch") } } @@ -358,32 +360,30 @@ func createReleaseFromPreviousTag(tagString, mainAppVersion string, recipe recip } newTag := lastGitTag - if bumpType > 0 { - if internal.Patch { - now, err := strconv.Atoi(newTag.Patch) - if err != nil { - return err - } - - newTag.Patch = strconv.Itoa(now + 1) - } else if internal.Minor { - now, err := strconv.Atoi(newTag.Minor) - if err != nil { - return err - } - - newTag.Patch = "0" - newTag.Minor = strconv.Itoa(now + 1) - } else if internal.Major { - now, err := strconv.Atoi(newTag.Major) - if err != nil { - return err - } - - newTag.Patch = "0" - newTag.Minor = "0" - newTag.Major = strconv.Itoa(now + 1) + if internal.Patch { + now, err := strconv.Atoi(newTag.Patch) + if err != nil { + return err } + + newTag.Patch = strconv.Itoa(now + 1) + } else if internal.Minor { + now, err := strconv.Atoi(newTag.Minor) + if err != nil { + return err + } + + newTag.Patch = "0" + newTag.Minor = strconv.Itoa(now + 1) + } else if internal.Major { + now, err := strconv.Atoi(newTag.Major) + if err != nil { + return err + } + + newTag.Patch = "0" + newTag.Minor = "0" + newTag.Major = strconv.Itoa(now + 1) } if err := commitRelease(recipe); err != nil {