Flamenco/cmd/update-version/makefile.go
Sybren A. Stüvel c1a728dc2f Version updates via Makefile
Flamenco now no longer uses the Git tags + hash for the application
version, but an explicit `VERSION` variable in the `Makefile`.

After changing the `VERSION` variable in the `Makefile`, run
`make update-version`.

Not every part of Flamenco looks at this variable, though. Most
importantly: the Blender add-on needs special handling, because that
doesn't just take a version string but a tuple of integers. Running
`make update-version` updates the add-on's `bl_info` dict with the new
version. If the version has any `-blabla` suffix (like `3.0-beta0`) it
will also set the `warning` field to explain that it's not a stable
release.
2022-07-25 16:08:07 +02:00

28 lines
567 B
Go

package main
import (
"fmt"
"strings"
"github.com/rs/zerolog/log"
)
const makefileFile = "Makefile"
// updateMakefile changes the version number in Makefile.
// Returns whether the file actually changed.
func updateMakefile() bool {
replacer := func(line string) string {
if !strings.HasPrefix(line, "VERSION := ") {
return line
}
return fmt.Sprintf("VERSION := %q", cliArgs.newVersion)
}
fileWasChanged, err := updateLines(makefileFile, replacer)
if err != nil {
log.Fatal().Err(err).Msg("error updating Makefile")
}
return fileWasChanged
}