diff --git a/cli/recipe/release.go b/cli/recipe/release.go index 9483a681..d5e6e805 100644 --- a/cli/recipe/release.go +++ b/cli/recipe/release.go @@ -81,7 +81,7 @@ You may invoke this command in "wizard" mode and be prompted for input: } if mainAppVersion == "" { - logrus.Fatalf("main 'app' service version for %s is empty?", recipe.Name) + logrus.Fatalf("main app service version for %s is empty?", recipe.Name) } if tagString != "" { @@ -116,6 +116,7 @@ You may invoke this command in "wizard" mode and be prompted for input: Message: "tag message", Default: fmt.Sprintf("chore: publish new %s version", internal.GetBumpType()), } + if err := survey.AskOne(prompt, &internal.TagMessage); err != nil { logrus.Fatal(err) } @@ -128,6 +129,7 @@ You may invoke this command in "wizard" mode and be prompted for input: prompt := &survey.Confirm{ Message: "git commit changes also?", } + if err := survey.AskOne(prompt, &internal.Commit); err != nil { return err } @@ -137,6 +139,7 @@ You may invoke this command in "wizard" mode and be prompted for input: prompt := &survey.Confirm{ Message: "git push changes also?", } + if err := survey.AskOne(prompt, &internal.Push); err != nil { return err } @@ -160,13 +163,13 @@ You may invoke this command in "wizard" mode and be prompted for input: if err := gitPkg.Commit("compose.**yml", internal.CommitMessage, internal.Dry, false); err != nil { logrus.Fatal(err) } - } repo, err := git.PlainOpen(directory) if err != nil { logrus.Fatal(err) } + head, err := repo.Head() if err != nil { logrus.Fatal(err) @@ -177,14 +180,17 @@ You may invoke this command in "wizard" mode and be prompted for input: if err != nil { logrus.Fatal(err) } + if tag.MissingMinor { tag.Minor = "0" tag.MissingMinor = false } + if tag.MissingPatch { tag.Patch = "0" tag.MissingPatch = false } + tagString = fmt.Sprintf("%s+%s", tag.String(), mainAppVersion) if internal.Dry { hash := abraFormatter.SmallSHA(head.Hash().String()) @@ -213,20 +219,24 @@ You may invoke this command in "wizard" mode and be prompted for input: if err != nil { logrus.Fatal(err) } + if err := iter.ForEach(func(ref *plumbing.Reference) error { obj, err := repo.TagObject(ref.Hash()) if err != nil { return err } + tagcmpTag, err := tagcmp.Parse(obj.Name) if err != nil { return err } + if (lastGitTag == tagcmp.Tag{}) { lastGitTag = tagcmpTag } else if tagcmpTag.IsGreaterThan(lastGitTag) { lastGitTag = tagcmpTag } + return nil }); err != nil { logrus.Fatal(err) @@ -240,12 +250,14 @@ You may invoke this command in "wizard" mode and be prompted for input: if err != nil { logrus.Fatal(err) } + newTag.Patch = strconv.Itoa(now + 1) } else if internal.Minor { now, err := strconv.Atoi(newTag.Minor) if err != nil { logrus.Fatal(err) } + newTag.Patch = "0" newTag.Minor = strconv.Itoa(now + 1) } else if internal.Major { @@ -253,6 +265,7 @@ You may invoke this command in "wizard" mode and be prompted for input: if err != nil { logrus.Fatal(err) } + newTag.Patch = "0" newTag.Minor = "0" newTag.Major = strconv.Itoa(now + 1)