Compare commits

...

12 commits

Author SHA1 Message Date
5e269a6209 feat: update -version output 2024-11-09 16:02:55 +01:00
8818964111 feat: always retrieve version from git tag 2024-11-09 15:59:30 +01:00
262b1fe033 XXX remove version.txt references 2024-11-09 15:59:06 +01:00
cdba66ac0c add yaml schemas to Taskfile.yml and .goreleaser.yaml 2024-11-09 15:58:14 +01:00
9a053a4123 add snapshot task 2024-11-09 15:58:14 +01:00
8c4ba60095 only run dorelase in main branch 2024-11-09 15:58:14 +01:00
02abad82e8 split tasks into indiviual units
create standalone `goreleaser` task
create standalone `dorelease` task
2024-11-09 15:58:14 +01:00
28be3affcd gorelaser: do force-remove ./dist 2024-11-09 15:58:14 +01:00
a032eead01 remove precheck and add warning prompt 2024-11-09 15:58:14 +01:00
e27d58ad8f limit git tasks to main branch 2024-11-09 15:58:14 +01:00
9ee70a71fe 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-09 15:58:14 +01:00
c937a7b904 fix: restore filter that excludes version bump entries 2024-11-09 15:58:14 +01:00
4 changed files with 61 additions and 7 deletions

View file

@ -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:
@ -25,6 +25,9 @@ upx:
changelog:
use: gitea
filters:
exclude:
- "chore: bump version to"
archives:
- format: binary

38
Taskfile.yml Normal file
View file

@ -0,0 +1,38 @@
# 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: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:tag
- task: release:goreleaser
snapshot:
desc: Create a local snapshot release
cmds:
- goreleaser release --clean --snapshot

View file

@ -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: %s\n", metadata.ProtocolVersion)
os.Exit(0)
}

View file

@ -1,7 +1,20 @@
package metadata
import "strings"
import (
"os/exec"
"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() {
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"
}
ProtocolVersion = strings.Split(GoTomatoVersion, ".")[0] // The protocol version
}