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 75 additions and 9 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:
|
||||
|
@ -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
|
||||
|
@ -25,6 +23,9 @@ upx:
|
|||
|
||||
changelog:
|
||||
use: gitea
|
||||
filters:
|
||||
exclude:
|
||||
- "chore: bump version to"
|
||||
|
||||
archives:
|
||||
- format: binary
|
||||
|
|
49
Taskfile.yml
Normal file
49
Taskfile.yml
Normal file
|
@ -0,0 +1,49 @@
|
|||
# yaml-language-server: $schema=https://taskfile.dev/schema.json
|
||||
version: '3'
|
||||
|
||||
vars:
|
||||
VERSIONFILE: version.txt
|
||||
RELEASE:
|
||||
sh: svu next --strip-prefix
|
||||
BRANCH:
|
||||
sh: git branch --show-current
|
||||
COMMIT:
|
||||
sh: git rev-parse --short --verify {{.BRANCH}}
|
||||
COMMITMSG: "chore: bump version to v{{.RELEASE}}"
|
||||
|
||||
tasks:
|
||||
release:tag:
|
||||
desc: Create a new tag
|
||||
cmds:
|
||||
- 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:
|
||||
- goreleaser release --clean
|
||||
|
||||
dorelease:
|
||||
desc: Do all release steps
|
||||
prompt: Create new release v{{.RELEASE}} from {{.COMMIT}}@{{.BRANCH}}?
|
||||
preconditions:
|
||||
- sh: test "{{.BRANCH}}" == "main"
|
||||
cmds:
|
||||
- task: release:file
|
||||
- task: release:tag
|
||||
- task: release:goreleaser
|
||||
|
||||
snapshot:
|
||||
desc: Create a local snapshot release
|
||||
cmds:
|
||||
- goreleaser release --clean --snapshot
|
|
@ -28,8 +28,8 @@ func Start() {
|
|||
|
||||
// show server and protocl version and exit
|
||||
if *showVersionFlag {
|
||||
fmt.Println("Server-Version:", metadata.GoTomatoVersion)
|
||||
fmt.Println("Protocol-Version:", metadata.ProtocolVersion)
|
||||
fmt.Printf("GoTomato v%s\n", metadata.GoTomatoVersion)
|
||||
fmt.Printf("Protocol-Version: v%s\n", metadata.ProtocolVersion)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,23 @@
|
|||
package metadata
|
||||
|
||||
import "strings"
|
||||
import (
|
||||
"fmt"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// This will be overwritten by goreleaser on build
|
||||
var GoTomatoVersion = "devel" // The GoTomato version
|
||||
var ProtocolVersion = strings.Split(GoTomatoVersion, ".")[0] // The protocol version
|
||||
var (
|
||||
GoTomatoVersion = "" // The GoTomato version
|
||||
ProtocolVersion = "" // The protocol version
|
||||
)
|
||||
|
||||
func init() {
|
||||
info, ok := debug.ReadBuildInfo()
|
||||
fmt.Printf("%v", info)
|
||||
if !ok {
|
||||
GoTomatoVersion = "unknown"
|
||||
}
|
||||
|
||||
GoTomatoVersion = info.Main.Version
|
||||
ProtocolVersion = strings.Split(GoTomatoVersion, ".")[0]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue