refactor: remove VERSION.txt, use git tags for version identification, defaulting

This commit is contained in:
2025-08-01 14:09:47 -05:00
parent 4bacef7bb9
commit 5bb9f327dc
4 changed files with 28 additions and 24 deletions

View File

@@ -1,12 +1,12 @@
version: '3'
version: "3"
vars:
BINARY_NAME: '{{.APP_NAME}}'
BINARY_NAME: "{{.APP_NAME}}"
tasks:
build:
cmds:
- go build -ldflags "-X main.Version=$(cat VERSION.txt) -X main.Commit=$(git rev-parse --short HEAD) -X 'main.BuildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ)'" -o ./bin/{{.BINARY_NAME}} ./cmd/main.go
- go build -ldflags "-X main.Version=$(git describe --tags --abbrev=0 2>/dev/null || echo 'unknown') -X main.Commit=$(git rev-parse --short HEAD) -X 'main.BuildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ)'" -o ./bin/{{.BINARY_NAME}} ./cmd/main.go
service:
desc: "Install the service"
@@ -30,4 +30,4 @@ tasks:
tail:
desc: "Tail the log file"
cmds:
- journalctl --user-unit HATray.service -ef
- journalctl --user-unit HATray.service -ef

View File

@@ -1,9 +1,9 @@
version: '3'
version: "3"
vars:
BINARY_NAME: '{{.APP_NAME}}.exe'
BINARY_NAME: "{{.APP_NAME}}.exe"
VERSION:
sh: powershell -Command "Get-Content VERSION.txt"
sh: powershell -Command "try { agit describe --tags --abbrev=0 } catch { 'unknown' }"
COMMIT:
sh: git rev-parse --short HEAD
@@ -34,7 +34,7 @@ tasks:
- cmd: pwsh -c 'Copy-Item -Force -Path .\\bin\\{{.BINARY_NAME}} -Destination $env:USERPROFILE\\AppData\\Local\\HATray\\{{.BINARY_NAME}}'
# Start the service
- cmd: pwsh -c 'sc start HATray'
status:
desc: "Show the status of the service"
cmds:
@@ -44,11 +44,11 @@ tasks:
desc: "Tail the log file"
cmds:
- cmd: pwsh -c 'Get-Content -Path $env:LOCALAPPDATA\\HATray\\current.log -Tail 10 -Wait'
package:
desc: "Package the application as a MSI"
deps: [build]
cmds:
- wix extension add WixToolset.Util.wixext
- wix extension add WixToolset.UI.wixext
- wix build -ext WixToolset.Util.wixext -ext WixToolset.UI.wixext -o ./bin/{{.APP_NAME}}.msi build/msi/HATray.wxs -arch x64 -d VERSION={{.VERSION}} -d SOURCE=./bin/{{.BINARY_NAME}}
- wix build -ext WixToolset.Util.wixext -ext WixToolset.UI.wixext -o ./bin/{{.APP_NAME}}.msi build/msi/HATray.wxs -arch x64 -d VERSION={{.VERSION}} -d SOURCE=./bin/{{.BINARY_NAME}}