mirror of
https://github.com/restic/restic.git
synced 2024-12-22 15:57:07 +00:00
Merge pull request #4909 from MichaelEischer/properly-set-dev-version
Fix VERSION file and dev version in binaries
This commit is contained in:
commit
f4ecb9d615
3 changed files with 10 additions and 5 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
0.16.5
|
0.16.5-dev
|
||||||
|
|
|
@ -43,7 +43,7 @@ import (
|
||||||
"golang.org/x/term"
|
"golang.org/x/term"
|
||||||
)
|
)
|
||||||
|
|
||||||
const version = "0.16.5-dev (compiled manually)"
|
var version = "0.16.5-dev (compiled manually)"
|
||||||
|
|
||||||
// TimeFormat is the format used for all timestamps printed by restic.
|
// TimeFormat is the format used for all timestamps printed by restic.
|
||||||
const TimeFormat = "2006-01-02 15:04:05"
|
const TimeFormat = "2006-01-02 15:04:05"
|
||||||
|
|
|
@ -303,7 +303,7 @@ func generateFiles() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var versionPattern = `const version = ".*"`
|
var versionPattern = `var version = ".*"`
|
||||||
|
|
||||||
const versionCodeFile = "cmd/restic/global.go"
|
const versionCodeFile = "cmd/restic/global.go"
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ func updateVersion() {
|
||||||
die("unable to write version to file: %v", err)
|
die("unable to write version to file: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
newVersion := fmt.Sprintf("const version = %q", opts.Version)
|
newVersion := fmt.Sprintf("var version = %q", opts.Version)
|
||||||
replace(versionCodeFile, versionPattern, newVersion)
|
replace(versionCodeFile, versionPattern, newVersion)
|
||||||
|
|
||||||
if len(uncommittedChanges("VERSION")) > 0 || len(uncommittedChanges(versionCodeFile)) > 0 {
|
if len(uncommittedChanges("VERSION")) > 0 || len(uncommittedChanges(versionCodeFile)) > 0 {
|
||||||
|
@ -323,7 +323,12 @@ func updateVersion() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateVersionDev() {
|
func updateVersionDev() {
|
||||||
newVersion := fmt.Sprintf(`const version = "%s-dev (compiled manually)"`, opts.Version)
|
err := os.WriteFile("VERSION", []byte(opts.Version+"-dev\n"), 0644)
|
||||||
|
if err != nil {
|
||||||
|
die("unable to write version to file: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
newVersion := fmt.Sprintf(`var version = "%s-dev (compiled manually)"`, opts.Version)
|
||||||
replace(versionCodeFile, versionPattern, newVersion)
|
replace(versionCodeFile, versionPattern, newVersion)
|
||||||
|
|
||||||
msg("committing cmd/restic/global.go with dev version")
|
msg("committing cmd/restic/global.go with dev version")
|
||||||
|
|
Loading…
Reference in a new issue