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
# 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

View File

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

View File

@ -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")

View File

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