Flamenco/cmd/update-version/website.go
Sybren A. Stüvel 7d2970bbe3 update-version: always quote the version number in YAML
Without quotes, YAML would see `3.0-beta1` as string, but `3.0` as float.
2022-09-12 15:55:21 +02:00

29 lines
644 B
Go

package main
import (
"fmt"
"strings"
"github.com/rs/zerolog/log"
)
const websiteFile = "web/project-website/data/flamenco.yaml"
// updateWebsite changes the version number of the latest version in the project
// website.
// Returns whether the file actually changed.
func updateWebsite() bool {
replacer := func(line string) string {
if !strings.HasPrefix(line, "latestVersion: ") {
return line
}
return fmt.Sprintf("latestVersion: %q", cliArgs.newVersion)
}
fileWasChanged, err := updateLines(websiteFile, replacer)
if err != nil {
log.Fatal().Err(err).Msg("error updating project website")
}
return fileWasChanged
}