Compare commits
13 commits
5e269a6209
...
95842b00fd
Author | SHA1 | Date | |
---|---|---|---|
95842b00fd | |||
8f0b197c3e | |||
25f237f73a | |||
62b7190fcd | |||
9ffe12bd6d | |||
4fd1e60fde | |||
63327bb3ea | |||
da4a2ce7b0 | |||
1ec32bc0d9 | |||
34026b1bc9 | |||
081e1ade47 | |||
e9d8d2e2dd | |||
6e19e43aa7 |
4 changed files with 21 additions and 9 deletions
|
@ -15,8 +15,6 @@ builds:
|
||||||
- arm64
|
- arm64
|
||||||
env:
|
env:
|
||||||
- CGO_ENABLED=0
|
- CGO_ENABLED=0
|
||||||
ldflags:
|
|
||||||
- -s -w -X git.smsvc.net/pomodoro/GoTomato/internal/metadata.GoTomatoVersion={{.Version}}
|
|
||||||
|
|
||||||
upx:
|
upx:
|
||||||
- enabled: true
|
- enabled: true
|
||||||
|
|
11
Taskfile.yml
11
Taskfile.yml
|
@ -18,6 +18,16 @@ tasks:
|
||||||
- git tag v{{.RELEASE}}
|
- git tag v{{.RELEASE}}
|
||||||
- git push --tags
|
- git push --tags
|
||||||
|
|
||||||
|
release:file:
|
||||||
|
desc: Update version.txt
|
||||||
|
generates:
|
||||||
|
- version.txt
|
||||||
|
cmds:
|
||||||
|
- echo {{.RELEASE}} >{{.VERSIONFILE}}
|
||||||
|
- git add {{.VERSIONFILE}}
|
||||||
|
- git commit -m "{{.COMMITMSG}}"
|
||||||
|
- git push
|
||||||
|
|
||||||
release:goreleaser:
|
release:goreleaser:
|
||||||
desc: Create a new release with goreleaser
|
desc: Create a new release with goreleaser
|
||||||
cmds:
|
cmds:
|
||||||
|
@ -29,6 +39,7 @@ tasks:
|
||||||
preconditions:
|
preconditions:
|
||||||
- sh: test "{{.BRANCH}}" == "main"
|
- sh: test "{{.BRANCH}}" == "main"
|
||||||
cmds:
|
cmds:
|
||||||
|
- task: release:file
|
||||||
- task: release:tag
|
- task: release:tag
|
||||||
- task: release:goreleaser
|
- task: release:goreleaser
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ func Start() {
|
||||||
// show server and protocl version and exit
|
// show server and protocl version and exit
|
||||||
if *showVersionFlag {
|
if *showVersionFlag {
|
||||||
fmt.Printf("GoTomato v%s\n", metadata.GoTomatoVersion)
|
fmt.Printf("GoTomato v%s\n", metadata.GoTomatoVersion)
|
||||||
fmt.Printf("Protocol-Version: %s\n", metadata.ProtocolVersion)
|
fmt.Printf("Protocol-Version: v%s\n", metadata.ProtocolVersion)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package metadata
|
package metadata
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os/exec"
|
"fmt"
|
||||||
|
"runtime/debug"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -11,10 +12,12 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
if GoTomatoVersion == "" {
|
info, ok := debug.ReadBuildInfo()
|
||||||
output, _ := exec.Command("git", "describe", "--tags").Output()
|
fmt.Printf("%v", info)
|
||||||
trimmed_output := strings.TrimSpace(string(output)) // strip newlines
|
if !ok {
|
||||||
GoTomatoVersion = strings.Replace(trimmed_output, "v", "", 1) // strip leading "v"
|
GoTomatoVersion = "unknown"
|
||||||
}
|
}
|
||||||
ProtocolVersion = strings.Split(GoTomatoVersion, ".")[0] // The protocol version
|
|
||||||
|
GoTomatoVersion = info.Main.Version
|
||||||
|
ProtocolVersion = strings.Split(GoTomatoVersion, ".")[0]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue