fix: take version from sync when releasing
This commit is contained in:
parent
1fd0941239
commit
24882e95b4
|
@ -99,9 +99,9 @@ keys configured on your account.
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if tagString == "" {
|
if tagString == "" && (!internal.Major && !internal.Minor && !internal.Patch) {
|
||||||
var err error
|
var err error
|
||||||
tagString, err = getLabelVersion(recipe)
|
tagString, err = getLabelVersion(recipe, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -314,11 +314,13 @@ func createReleaseFromPreviousTag(tagString, mainAppVersion string, recipe recip
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var lastGitTag tagcmp.Tag
|
||||||
|
if tagString == "" {
|
||||||
if err := internal.PromptBumpType(tagString); err != nil {
|
if err := internal.PromptBumpType(tagString); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var lastGitTag tagcmp.Tag
|
|
||||||
for _, tag := range tags {
|
for _, tag := range tags {
|
||||||
parsed, err := tagcmp.Parse(tag)
|
parsed, err := tagcmp.Parse(tag)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -359,12 +361,14 @@ func createReleaseFromPreviousTag(tagString, mainAppVersion string, recipe recip
|
||||||
newTag.Major = strconv.Itoa(now + 1)
|
newTag.Major = strconv.Itoa(now + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if internal.Major || internal.Minor || internal.Patch {
|
||||||
newTag.Metadata = mainAppVersion
|
newTag.Metadata = mainAppVersion
|
||||||
newTagString := newTag.String()
|
tagString = newTag.String()
|
||||||
|
}
|
||||||
|
|
||||||
if !internal.NoInput {
|
if !internal.NoInput {
|
||||||
prompt := &survey.Confirm{
|
prompt := &survey.Confirm{
|
||||||
Message: fmt.Sprintf("current: %s, new: %s, correct?", lastGitTag, newTagString),
|
Message: fmt.Sprintf("current: %s, new: %s, correct?", lastGitTag, tagString),
|
||||||
}
|
}
|
||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
|
@ -377,15 +381,15 @@ func createReleaseFromPreviousTag(tagString, mainAppVersion string, recipe recip
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := commitRelease(recipe, newTagString); err != nil {
|
if err := commitRelease(recipe, tagString); err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := tagRelease(newTagString, repo); err != nil {
|
if err := tagRelease(tagString, repo); err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := pushRelease(recipe); err != nil {
|
if err := pushRelease(recipe, tagString); err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +415,7 @@ func cleanUpTag(tag, recipeName string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getLabelVersion(recipe recipe.Recipe) (string, error) {
|
func getLabelVersion(recipe recipe.Recipe, prompt bool) (string, error) {
|
||||||
initTag, err := recipePkg.GetVersionLabelLocal(recipe)
|
initTag, err := recipePkg.GetVersionLabelLocal(recipe)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
@ -423,7 +427,7 @@ func getLabelVersion(recipe recipe.Recipe) (string, error) {
|
||||||
|
|
||||||
logrus.Warnf("discovered %s as currently synced recipe label", initTag)
|
logrus.Warnf("discovered %s as currently synced recipe label", initTag)
|
||||||
|
|
||||||
if !internal.NoInput {
|
if prompt && !internal.NoInput {
|
||||||
var response bool
|
var response bool
|
||||||
prompt := &survey.Confirm{Message: fmt.Sprintf("use %s as the new version?", initTag)}
|
prompt := &survey.Confirm{Message: fmt.Sprintf("use %s as the new version?", initTag)}
|
||||||
if err := survey.AskOne(prompt, &response); err != nil {
|
if err := survey.AskOne(prompt, &response); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue