Compare commits
12 commits
95842b00fd
...
5e269a6209
Author | SHA1 | Date | |
---|---|---|---|
5e269a6209 | |||
8818964111 | |||
262b1fe033 | |||
cdba66ac0c | |||
9a053a4123 | |||
8c4ba60095 | |||
02abad82e8 | |||
28be3affcd | |||
a032eead01 | |||
e27d58ad8f | |||
9ee70a71fe | |||
c937a7b904 |
4 changed files with 9 additions and 21 deletions
|
@ -15,6 +15,8 @@ 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,16 +18,6 @@ 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:
|
||||||
|
@ -39,7 +29,6 @@ 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: v%s\n", metadata.ProtocolVersion)
|
fmt.Printf("Protocol-Version: %s\n", metadata.ProtocolVersion)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package metadata
|
package metadata
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"os/exec"
|
||||||
"runtime/debug"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -12,12 +11,10 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
info, ok := debug.ReadBuildInfo()
|
if GoTomatoVersion == "" {
|
||||||
fmt.Printf("%v", info)
|
output, _ := exec.Command("git", "describe", "--tags").Output()
|
||||||
if !ok {
|
trimmed_output := strings.TrimSpace(string(output)) // strip newlines
|
||||||
GoTomatoVersion = "unknown"
|
GoTomatoVersion = strings.Replace(trimmed_output, "v", "", 1) // strip leading "v"
|
||||||
}
|
}
|
||||||
|
ProtocolVersion = strings.Split(GoTomatoVersion, ".")[0] // The protocol version
|
||||||
GoTomatoVersion = info.Main.Version
|
|
||||||
ProtocolVersion = strings.Split(GoTomatoVersion, ".")[0]
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue