Files
HATray/tasks/Taskfile_windows.yml

37 lines
1.2 KiB
YAML

version: '3'
vars:
BINARY_NAME: '{{.APP_NAME}}.exe'
tasks:
build:
cmds:
- go build -o ./bin/{{.BINARY_NAME}} ./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'
tail:
desc: "Tail the log file"
cmds:
- cmd: pwsh -c 'Get-Content -Path $env:USERPROFILE\AppData\Local\HATray\current.log -Tail 100 -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}}-{{.VERSION}}.msi build/msi/HATray.wxs -arch x64 -d VERSION={{.VERSION}} -d SOURCE=./bin/{{.BINARY_NAME}}