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