Compare commits

..

13 commits

Author SHA1 Message Date
95842b00fd try to get version from runtime/debug 2024-11-09 14:56:44 +01:00
8f0b197c3e add yaml schemas to Taskfile.yml and .goreleaser.yaml 2024-11-09 11:01:09 +01:00
25f237f73a add snapshot task 2024-11-09 10:13:52 +01:00
62b7190fcd only run dorelase in main branch 2024-11-09 09:59:51 +01:00
9ffe12bd6d split tasks into indiviual units
create standalone `goreleaser` task
create standalone `dorelease` task
2024-11-09 09:54:44 +01:00
4fd1e60fde gorelaser: do force-remove ./dist 2024-11-09 09:51:07 +01:00
63327bb3ea remove precheck and add warning prompt 2024-11-08 17:44:10 +01:00
da4a2ce7b0 limit git tasks to main branch 2024-11-08 17:30:28 +01:00
1ec32bc0d9 feat: add release management via taskdev
- create `Taskfile.yml`
- update version file with the new release version
- add new version tag
- push to remote and run goreleaser
2024-11-08 17:30:28 +01:00
34026b1bc9 fix: restore filter that excludes version bump entries 2024-11-08 17:30:28 +01:00
081e1ade47 feat: update -version output 2024-11-08 17:30:28 +01:00
e9d8d2e2dd feat: move version string to version.txt
- create version.txt to store the version number
- add function to read version from version.txt
- replace hardcoded version with dynamic retrieval
2024-11-08 17:30:25 +01:00
6e19e43aa7 Revert "feat: set version from git tag on build"
This reverts commit 61fc21224c.
2024-11-08 14:18:08 +01:00
4 changed files with 21 additions and 9 deletions

View file

@ -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

View file

@ -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

View file

@ -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)
}

View file

@ -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]
}