// Release current branch. Remove PreRelease, tag, bump version, push
Release current branch. Remove PreRelease, tag, bump version, push
// Release current branch . Remove PreRelease tag bump version push
func Release() {
	gochips.Doing("Pulling")
	err := new(gochips.PipedExec).
		Command("git", "pull").
		Run(os.Stdout, os.Stdout)
	gochips.ExitIfError(err)
	gochips.Doing("Reading current version")
	currentVersion, err := utils.ReadVersion()
	gochips.ExitIfError(err, "Error reading file 'version'")
	gochips.ExitIfFalse(len(currentVersion.PreRelease) > 0, "pre-release part of version does not exist: "+currentVersion.String())
	targetVersion := currentVersion
	targetVersion.PreRelease = ""
	fmt.Printf("Version %v will be tagged, bumped and pushed, agree? [y]", targetVersion)
	var response string
	fmt.Scanln(&response)
	gochips.ExitIfFalse(response == "y")
	gochips.Doing("Updating 'version' file")
	gochips.ExitIfError(targetVersion.Save())
	gochips.Doing("Commiting target version")
	{
		params := []string{"commit", "-a", "-m", "#scm-ver " + targetVersion.String()}
		err = new(gochips.PipedExec).
			Command("git", params...).
			Run(os.Stdout, os.Stdout)
		gochips.ExitIfError(err)
	}
	gochips.Doing("Tagging")
	{
		tagName := "v" + targetVersion.String()
		n := time.Now()
		params := []string{"tag", "-m", "Version " + tagName + " of " + n.Format("2006/01/02 15:04:05"), tagName}
		err = new(gochips.PipedExec).
			Command("git", params...).
			Run(os.Stdout, os.Stdout)
		gochips.ExitIfError(err)
	}
	gochips.Doing("Bumping version")
	newVersion := currentVersion
	{
		newVersion.Minor++
		newVersion.PreRelease = "SNAPSHOT"
		gochips.ExitIfError(newVersion.Save())
	}
	gochips.Doing("Commiting new version")
	{
		params := []string{"commit", "-a", "-m", "#scm-ver " + newVersion.String()}
		err = new(gochips.PipedExec).
			Command("git", params...).
			Run(os.Stdout, os.Stdout)
		gochips.ExitIfError(err)
	}
	gochips.Doing("Pushing to origin")
	{
		params := []string{"push", "--follow-tags", "origin"}
		err = new(gochips.PipedExec).
			Command("git", params...).
			Run(os.Stdout, os.Stdout)
		gochips.ExitIfError(err)
	}
}
func Release ( ) { gochips . Doing ( " " ) err := new ( gochips . PipedExec ) . Command ( " " , " " ) . Run ( os . Stdout , os . Stdout ) gochips . ExitIfError ( err ) gochips . Doing ( " " ) currentVersion , err := utils . ReadVersion ( ) gochips . ExitIfError ( err , " " ) gochips . ExitIfFalse ( len ( currentVersion . PreRelease ) > 0 , " " + currentVersion . String ( ) ) targetVersion := currentVersion targetVersion . PreRelease = " " fmt . Printf ( " " , targetVersion ) var response string fmt . Scanln ( & response ) gochips . ExitIfFalse ( response == " " ) gochips . Doing ( " " ) gochips . ExitIfError ( targetVersion . Save ( ) ) gochips . Doing ( " " ) { params := [ ] string { " " , " " , " " , " " + targetVersion . String ( ) } err = new ( gochips . PipedExec ) . Command ( " " , params ... ) . Run ( os . Stdout , os . Stdout ) gochips . ExitIfError ( err ) } gochips . Doing ( " " ) { tagName := " " + targetVersion . String ( ) n := time . Now ( ) params := [ ] string { " " , " " , " " + tagName + " " + n . Format ( " " ) , tagName } err = new ( gochips . PipedExec ) . Command ( " " , params ... ) . Run ( os . Stdout , os . Stdout ) gochips . ExitIfError ( err ) } gochips . Doing ( " " ) newVersion := currentVersion { newVersion . Minor ++ newVersion . PreRelease = " " gochips . ExitIfError ( newVersion . Save ( ) ) } gochips . Doing ( " " ) { params := [ ] string { " " , " " , " " , " " + newVersion . String ( ) } err = new ( gochips . PipedExec ) . Command ( " " , params ... ) . Run ( os . Stdout , os . Stdout ) gochips . ExitIfError ( err ) } gochips . Doing ( " " ) { params := [ ] string { " " , " " , " " } err = new ( gochips . PipedExec ) . Command ( " " , params ... ) . Run ( os . Stdout , os . Stdout ) gochips . ExitIfError ( err ) } }
Release current branch.
Release current branch .
// ************************************************* // ************************************************* // Calculate target version // ************************************************* // ************************************************* // ************************************************* // ************************************************* // ************************************************* // *************************************************