mirror of
https://github.com/Xevion/HATray.git
synced 2025-12-06 07:15:10 -06:00
54 lines
1.7 KiB
YAML
54 lines
1.7 KiB
YAML
version: '3'
|
|
|
|
vars:
|
|
BINARY_NAME: '{{.APP_NAME}}.exe'
|
|
VERSION:
|
|
sh: powershell -Command "Get-Content VERSION.txt"
|
|
COMMIT:
|
|
sh: git rev-parse --short HEAD
|
|
|
|
tasks:
|
|
build:
|
|
vars:
|
|
BUILDDATE:
|
|
sh: powershell -Command "Get-Date -Format yyyy-MM-ddTHH:mm:ssZ"
|
|
cmds:
|
|
- go build -ldflags "-X main.Version={{.VERSION}} -X main.Commit={{.COMMIT}} -X 'main.BuildDate={{.BUILDDATE}}'" -o ./bin/{{.BINARY_NAME}} ./cmd/main.go
|
|
|
|
run:
|
|
desc: "Run the application"
|
|
cmds:
|
|
- go run ./cmd/main.go
|
|
|
|
service:
|
|
desc: "Install the service"
|
|
deps: [build]
|
|
cmds:
|
|
# Create the service, if not already present
|
|
- cmd: pwsh -c 'sc create HATray binPath= "$env:USERPROFILE\\AppData\\Local\\HATray\\{{.BINARY_NAME}}" start=auto'
|
|
ignore_error: true
|
|
# Stop the service, if running
|
|
- cmd: pwsh -c 'sc stop HATray'
|
|
ignore_error: true
|
|
# Replace the binary
|
|
- 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:
|
|
- cmd: sc query HATray
|
|
|
|
tail:
|
|
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}} |