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
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
ldflags:
|
||||
- -s -w -X git.smsvc.net/pomodoro/GoTomato/internal/metadata.GoTomatoVersion={{.Version}}
|
||||
|
||||
upx:
|
||||
- enabled: true
|
||||
|
|
11
Taskfile.yml
11
Taskfile.yml
|
@ -18,6 +18,16 @@ tasks:
|
|||
- git tag v{{.RELEASE}}
|
||||
- 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:
|
||||
desc: Create a new release with goreleaser
|
||||
cmds:
|
||||
|
@ -29,6 +39,7 @@ tasks:
|
|||
preconditions:
|
||||
- sh: test "{{.BRANCH}}" == "main"
|
||||
cmds:
|
||||
- task: release:file
|
||||
- task: release:tag
|
||||
- task: release:goreleaser
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ func Start() {
|
|||
// show server and protocl version and exit
|
||||
if *showVersionFlag {
|
||||
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)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package metadata
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"fmt"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
@ -11,10 +12,12 @@ var (
|
|||
)
|
||||
|
||||
func init() {
|
||||
if GoTomatoVersion == "" {
|
||||
output, _ := exec.Command("git", "describe", "--tags").Output()
|
||||
trimmed_output := strings.TrimSpace(string(output)) // strip newlines
|
||||
GoTomatoVersion = strings.Replace(trimmed_output, "v", "", 1) // strip leading "v"
|
||||
info, ok := debug.ReadBuildInfo()
|
||||
fmt.Printf("%v", info)
|
||||
if !ok {
|
||||
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