Take release cycle from makefile instead of parsing the version

Take the release cycle from the `RELEASE_CYCLE` variable in the Makefile,
instead of parsing `VERSION`.

For alpha/beta/rc/release this doesn't matter, it was parsed correctly.
But other suffixes were all marked as "release", which wasn't correct.
This commit is contained in:
Sybren A. Stüvel 2025-07-29 17:11:33 +02:00
parent cb8354f784
commit 4b0cdfb735
4 changed files with 9 additions and 20 deletions

View File

@ -3,7 +3,7 @@
PKG := projects.blender.org/studio/flamenco PKG := projects.blender.org/studio/flamenco
# To update the version number in all the relevant places, update the VERSION # 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 VERSION := 3.8-alpha1
# "alpha", "beta", or "release". # "alpha", "beta", or "release".
RELEASE_CYCLE := alpha RELEASE_CYCLE := alpha
@ -113,7 +113,7 @@ update-version:
@echo "--- Updating Flamenco version to ${VERSION}" @echo "--- Updating Flamenco version to ${VERSION}"
@echo "--- If this stops with exit status 42, it was already at that version." @echo "--- If this stops with exit status 42, it was already at that version."
@echo @echo
go run ./cmd/update-version ${VERSION} go run ./cmd/update-version ${VERSION} ${RELEASE_CYCLE}
$(MAKE) generate-py $(MAKE) generate-py
$(MAKE) generate-js $(MAKE) generate-js
@echo @echo

View File

@ -30,7 +30,7 @@ func updateMagefiles() bool {
// Perform replacements on the AST. // Perform replacements on the AST.
replacements := map[string]string{ replacements := map[string]string{
"version": cliArgs.newVersion, "version": cliArgs.newVersion,
"releaseCycle": releaseCycle, "releaseCycle": cliArgs.releaseCycle,
} }
var ( var (

View File

@ -6,7 +6,6 @@ import (
"flag" "flag"
"fmt" "fmt"
"os" "os"
"strings"
"time" "time"
"github.com/mattn/go-colorable" "github.com/mattn/go-colorable"
@ -22,9 +21,8 @@ var (
newVersion string newVersion string
updateMakefile bool updateMakefile bool
}
releaseCycle string releaseCycle string
}
) )
func main() { func main() {
@ -35,17 +33,6 @@ func main() {
log.Info().Str("version", cliArgs.newVersion).Msg("updating Flamenco version") 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 var anyFileWasChanged bool
if cliArgs.updateMakefile { if cliArgs.updateMakefile {
anyFileWasChanged = updateMakefile() || anyFileWasChanged anyFileWasChanged = updateMakefile() || anyFileWasChanged
@ -73,8 +60,10 @@ func parseCliArgs() {
flag.Parse() flag.Parse()
cliArgs.newVersion = flag.Arg(0) cliArgs.newVersion = flag.Arg(0)
if cliArgs.newVersion == "" { cliArgs.releaseCycle = flag.Arg(1)
os.Stderr.WriteString(fmt.Sprintf("Usage: %s [-quiet|-debug|-trace] {new Flamenco version number}\n", os.Args[0]))
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") os.Stderr.WriteString("\n")
flag.PrintDefaults() flag.PrintDefaults()
os.Stderr.WriteString("\n") os.Stderr.WriteString("\n")

View File

@ -9,7 +9,7 @@ import (
) )
// To update the version number in all the relevant places, update the VERSION // 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 ( const (
version = "3.8-alpha1" version = "3.8-alpha1"
releaseCycle = "alpha" releaseCycle = "alpha"