feat: set version from git tag on build
- add version variable and default it to "devel" - add ldflags to `.goreleaser.yaml` for version tagging
This commit is contained in:
parent
f058f6c6d3
commit
9247df0891
2 changed files with 13 additions and 2 deletions
|
@ -15,6 +15,8 @@ builds:
|
|||
- arm64
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
ldflags:
|
||||
- -s -w -X git.smsvc.net/pomodoro/ChronoTomato/cmd/client.version={{.Version}}
|
||||
|
||||
upx:
|
||||
- enabled: true
|
||||
|
|
|
@ -2,6 +2,8 @@ package client
|
|||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"git.smsvc.net/pomodoro/ChronoTomato/internal/helper"
|
||||
"git.smsvc.net/pomodoro/ChronoTomato/internal/websocket"
|
||||
|
@ -13,6 +15,7 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
version = "devel"
|
||||
config ChronoTomato.Config
|
||||
client websocket.Client
|
||||
)
|
||||
|
@ -68,9 +71,15 @@ func Start() {
|
|||
parameter_url = flag.String("url", "", "GoTomato Server URL (eg ws://localhost:8080/ws)")
|
||||
parameter_password = flag.String("password", "", "Control password for pomodoro session")
|
||||
parameter_configfile = flag.String("config", defaultConfigFile, "Path to config file")
|
||||
showVersion = flag.Bool("version", false, "Show Version")
|
||||
)
|
||||
flag.Parse()
|
||||
|
||||
if *showVersion {
|
||||
fmt.Println("ChronoTomato", version)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
// read passed config file or try to use default config
|
||||
if *parameter_configfile != defaultConfigFile {
|
||||
config = helper.ParseConfig(*parameter_configfile)
|
||||
|
|
Loading…
Reference in a new issue