Compare commits
5 commits
aaad07bc77
...
36dca57830
Author | SHA1 | Date | |
---|---|---|---|
36dca57830 | |||
10021eb65e | |||
09dbf35a6a | |||
58d658be66 | |||
05e8bf5854 |
6 changed files with 81 additions and 18 deletions
|
@ -1,10 +1,10 @@
|
|||
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
|
||||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
|
||||
|
||||
version: 2
|
||||
|
||||
before:
|
||||
hooks:
|
||||
- rm -fr ./dist
|
||||
- go mod tidy
|
||||
|
||||
builds:
|
||||
|
@ -16,7 +16,7 @@ builds:
|
|||
env:
|
||||
- CGO_ENABLED=0
|
||||
ldflags:
|
||||
- -s -w -X git.smsvc.net/pomodoro/ChronoTomato/cmd/client.version={{.Version}}
|
||||
- -s -w -X {{.ModulePath}}/internal/metadata.ChronoTomatoVersion={{.Version}}
|
||||
|
||||
upx:
|
||||
- enabled: true
|
||||
|
|
34
Taskfile.yml
Normal file
34
Taskfile.yml
Normal file
|
@ -0,0 +1,34 @@
|
|||
# yaml-language-server: $schema=https://taskfile.dev/schema.json
|
||||
#
|
||||
# github.com/go-task/task/v3/cmd/task@latest
|
||||
# Requirements:
|
||||
# github.com/caarlos0/svu@latest
|
||||
# github.com/goreleaser/goreleaser/v2@latest
|
||||
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
|
||||
release:
|
||||
desc: Create and publish an new release
|
||||
vars:
|
||||
RELEASE:
|
||||
sh: svu next
|
||||
BRANCH:
|
||||
sh: git branch --show-current
|
||||
COMMIT:
|
||||
sh: git rev-parse --short --verify {{.BRANCH}}
|
||||
preconditions:
|
||||
- sh: test "{{.BRANCH}}" == "main"
|
||||
msg: "You must be on the main branch to release"
|
||||
prompt: Create new release {{.RELEASE}} from {{.COMMIT}}@{{.BRANCH}}?
|
||||
cmds:
|
||||
- git tag {{.RELEASE}}
|
||||
- git push
|
||||
- git push origin tag {{.RELEASE}}
|
||||
- goreleaser release --clean
|
||||
|
||||
snapshot:
|
||||
desc: Create a local snapshot release
|
||||
cmds:
|
||||
- goreleaser release --clean --snapshot
|
|
@ -6,6 +6,7 @@ import (
|
|||
"os"
|
||||
|
||||
"git.smsvc.net/pomodoro/ChronoTomato/internal/helper"
|
||||
"git.smsvc.net/pomodoro/ChronoTomato/internal/metadata"
|
||||
"git.smsvc.net/pomodoro/ChronoTomato/internal/websocket"
|
||||
ChronoTomato "git.smsvc.net/pomodoro/ChronoTomato/pkg/models"
|
||||
GoTomato "git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
||||
|
@ -15,9 +16,8 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
version = "devel"
|
||||
config ChronoTomato.Config
|
||||
client websocket.Client
|
||||
config ChronoTomato.Config
|
||||
client websocket.Client
|
||||
)
|
||||
|
||||
type app struct {
|
||||
|
@ -76,7 +76,7 @@ func Start() {
|
|||
flag.Parse()
|
||||
|
||||
if *showVersion {
|
||||
fmt.Println("ChronoTomato", version)
|
||||
fmt.Println("ChronoTomato", metadata.ChronoTomatoVersion)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
|
|
8
go.mod
8
go.mod
|
@ -3,10 +3,10 @@ module git.smsvc.net/pomodoro/ChronoTomato
|
|||
go 1.23.1
|
||||
|
||||
require (
|
||||
git.smsvc.net/pomodoro/GoTomato v0.2.0
|
||||
git.smsvc.net/pomodoro/GoTomato v0.0.8
|
||||
github.com/alecthomas/colour v0.1.0
|
||||
github.com/charmbracelet/bubbles v0.20.0
|
||||
github.com/charmbracelet/bubbletea v1.2.1
|
||||
github.com/charmbracelet/bubbletea v1.1.2
|
||||
github.com/charmbracelet/log v0.4.0
|
||||
github.com/gen2brain/beeep v0.0.0-20240516210008-9c006672e7f4
|
||||
github.com/gorilla/websocket v1.5.3
|
||||
|
@ -15,8 +15,8 @@ require (
|
|||
|
||||
require (
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||
github.com/charmbracelet/lipgloss v1.0.0 // indirect
|
||||
github.com/charmbracelet/x/ansi v0.4.5 // indirect
|
||||
github.com/charmbracelet/lipgloss v0.13.0 // indirect
|
||||
github.com/charmbracelet/x/ansi v0.4.0 // indirect
|
||||
github.com/charmbracelet/x/term v0.2.0 // indirect
|
||||
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
|
||||
github.com/go-logfmt/logfmt v0.6.0 // indirect
|
||||
|
|
16
go.sum
16
go.sum
|
@ -1,19 +1,19 @@
|
|||
git.smsvc.net/pomodoro/GoTomato v0.2.0 h1:/Wkft5ESsKNJIKiu6OJ7sKvY8LhW6acpTcMy89DLd0s=
|
||||
git.smsvc.net/pomodoro/GoTomato v0.2.0/go.mod h1:LaKrPdnFB5v4RpltExKasW67TmjJlmhDDvmoEYWv0P4=
|
||||
git.smsvc.net/pomodoro/GoTomato v0.0.8 h1:ePD6T14pFtrtXybHypabpDs4MURdOnPkm8nQzzEteVA=
|
||||
git.smsvc.net/pomodoro/GoTomato v0.0.8/go.mod h1:LaKrPdnFB5v4RpltExKasW67TmjJlmhDDvmoEYWv0P4=
|
||||
github.com/alecthomas/colour v0.1.0 h1:nOE9rJm6dsZ66RGWYSFrXw461ZIt9A6+nHgL7FRrDUk=
|
||||
github.com/alecthomas/colour v0.1.0/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0=
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
|
||||
github.com/charmbracelet/bubbles v0.20.0 h1:jSZu6qD8cRQ6k9OMfR1WlM+ruM8fkPWkHvQWD9LIutE=
|
||||
github.com/charmbracelet/bubbles v0.20.0/go.mod h1:39slydyswPy+uVOHZ5x/GjwVAFkCsV8IIVy+4MhzwwU=
|
||||
github.com/charmbracelet/bubbletea v1.2.1 h1:J041h57zculJKEKf/O2pS4edXGIz+V0YvojvfGXePIk=
|
||||
github.com/charmbracelet/bubbletea v1.2.1/go.mod h1:viLoDL7hG4njLJSKU2gw7kB3LSEmWsrM80rO1dBJWBI=
|
||||
github.com/charmbracelet/lipgloss v1.0.0 h1:O7VkGDvqEdGi93X+DeqsQ7PKHDgtQfF8j8/O2qFMQNg=
|
||||
github.com/charmbracelet/lipgloss v1.0.0/go.mod h1:U5fy9Z+C38obMs+T+tJqst9VGzlOYGj4ri9reL3qUlo=
|
||||
github.com/charmbracelet/bubbletea v1.1.2 h1:naQXF2laRxyLyil/i7fxdpiz1/k06IKquhm4vBfHsIc=
|
||||
github.com/charmbracelet/bubbletea v1.1.2/go.mod h1:9HIU/hBV24qKjlehyj8z1r/tR9TYTQEag+cWZnuXo8E=
|
||||
github.com/charmbracelet/lipgloss v0.13.0 h1:4X3PPeoWEDCMvzDvGmTajSyYPcZM4+y8sCA/SsA3cjw=
|
||||
github.com/charmbracelet/lipgloss v0.13.0/go.mod h1:nw4zy0SBX/F/eAO1cWdcvy6qnkDUxr8Lw7dvFrAIbbY=
|
||||
github.com/charmbracelet/log v0.4.0 h1:G9bQAcx8rWA2T3pWvx7YtPTPwgqpk7D68BX21IRW8ZM=
|
||||
github.com/charmbracelet/log v0.4.0/go.mod h1:63bXt/djrizTec0l11H20t8FDSvA4CRZJ1KH22MdptM=
|
||||
github.com/charmbracelet/x/ansi v0.4.5 h1:LqK4vwBNaXw2AyGIICa5/29Sbdq58GbGdFngSexTdRM=
|
||||
github.com/charmbracelet/x/ansi v0.4.5/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw=
|
||||
github.com/charmbracelet/x/ansi v0.4.0 h1:NqwHA4B23VwsDn4H3VcNX1W1tOmgnvY1NDx5tOXdnOU=
|
||||
github.com/charmbracelet/x/ansi v0.4.0/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw=
|
||||
github.com/charmbracelet/x/term v0.2.0 h1:cNB9Ot9q8I711MyZ7myUR5HFWL/lc3OpU8jZ4hwm0x0=
|
||||
github.com/charmbracelet/x/term v0.2.0/go.mod h1:GVxgxAbjUrmpvIINHIQnJJKpMlHiZ4cktEQCN6GWyF0=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
|
|
29
internal/metadata/version.go
Normal file
29
internal/metadata/version.go
Normal file
|
@ -0,0 +1,29 @@
|
|||
package metadata
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var ChronoTomatoVersion = ""
|
||||
|
||||
func getLatestTag() string {
|
||||
bytes, _ := exec.Command("git", "describe", "--tags").Output()
|
||||
output := strings.TrimSpace(string(bytes))
|
||||
return output
|
||||
}
|
||||
|
||||
// set GoTomatoVersion from runtime/debug.Main.Version
|
||||
// use latest git tag as fallback
|
||||
// can be overwritten via ldflags (e,g. by goreleaser)
|
||||
func init() {
|
||||
if ChronoTomatoVersion == "" {
|
||||
info, _ := debug.ReadBuildInfo()
|
||||
if info.Main.Version != "(devel)" {
|
||||
ChronoTomatoVersion = info.Main.Version
|
||||
} else {
|
||||
ChronoTomatoVersion = getLatestTag()
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue