diff --git a/Makefile b/Makefile index 35b56012..8f297451 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ PKG := projects.blender.org/studio/flamenco # To update the version number in all the relevant places, update the VERSION -# variable below and run `make update-version`. +# and RELEASE_CYCLE variables below and run `make update-version`. VERSION := 3.8-alpha1 # "alpha", "beta", or "release". RELEASE_CYCLE := alpha @@ -113,7 +113,7 @@ update-version: @echo "--- Updating Flamenco version to ${VERSION}" @echo "--- If this stops with exit status 42, it was already at that version." @echo - go run ./cmd/update-version ${VERSION} + go run ./cmd/update-version ${VERSION} ${RELEASE_CYCLE} $(MAKE) generate-py $(MAKE) generate-js @echo diff --git a/cmd/update-version/magefiles.go b/cmd/update-version/magefiles.go index 8171e498..04135fcc 100644 --- a/cmd/update-version/magefiles.go +++ b/cmd/update-version/magefiles.go @@ -30,7 +30,7 @@ func updateMagefiles() bool { // Perform replacements on the AST. replacements := map[string]string{ "version": cliArgs.newVersion, - "releaseCycle": releaseCycle, + "releaseCycle": cliArgs.releaseCycle, } var ( diff --git a/cmd/update-version/main.go b/cmd/update-version/main.go index 70f9f0fe..014a3441 100644 --- a/cmd/update-version/main.go +++ b/cmd/update-version/main.go @@ -6,7 +6,6 @@ import ( "flag" "fmt" "os" - "strings" "time" "github.com/mattn/go-colorable" @@ -22,9 +21,8 @@ var ( newVersion string updateMakefile bool + releaseCycle string } - - releaseCycle string ) func main() { @@ -35,17 +33,6 @@ func main() { log.Info().Str("version", cliArgs.newVersion).Msg("updating Flamenco version") - switch { - case strings.Contains(cliArgs.newVersion, "alpha"), strings.Contains(cliArgs.newVersion, "dev"): - releaseCycle = "alpha" - case strings.Contains(cliArgs.newVersion, "beta"): - releaseCycle = "beta" - case strings.Contains(cliArgs.newVersion, "rc"): - releaseCycle = "rc" - default: - releaseCycle = "release" - } - var anyFileWasChanged bool if cliArgs.updateMakefile { anyFileWasChanged = updateMakefile() || anyFileWasChanged @@ -73,8 +60,10 @@ func parseCliArgs() { flag.Parse() cliArgs.newVersion = flag.Arg(0) - if cliArgs.newVersion == "" { - os.Stderr.WriteString(fmt.Sprintf("Usage: %s [-quiet|-debug|-trace] {new Flamenco version number}\n", os.Args[0])) + cliArgs.releaseCycle = flag.Arg(1) + + if cliArgs.newVersion == "" || cliArgs.releaseCycle == "" { + os.Stderr.WriteString(fmt.Sprintf("Usage: %s [-quiet|-debug|-trace] {new Flamenco version number} {release cycle}\n", os.Args[0])) os.Stderr.WriteString("\n") flag.PrintDefaults() os.Stderr.WriteString("\n") diff --git a/magefiles/version.go b/magefiles/version.go index 0f31e49e..fe6d29b9 100644 --- a/magefiles/version.go +++ b/magefiles/version.go @@ -9,7 +9,7 @@ import ( ) // To update the version number in all the relevant places, update the VERSION -// variable below and run `mage update-version`. +// variable below and run `make update-version`. const ( version = "3.8-alpha1" releaseCycle = "alpha"