fix: release functionality working again
continuous-integration/drone/push Build is failing Details

This commit is contained in:
decentral1se 2021-12-22 01:36:41 +01:00
parent 1b9097f9f3
commit 04b58230ea
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
1 changed files with 29 additions and 29 deletions

View File

@ -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 {