version: "3" vars: BINARY_NAME: "{{.APP_NAME}}" tasks: build: cmds: - 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" deps: [build] cmds: - mkdir -p $HOME/.config/systemd/user - cmd: systemctl stop HATray --user ignore_error: true - cp ./bin/{{.BINARY_NAME}} $HOME/.local/bin/{{.BINARY_NAME}} # super hacky way of fixing MAINPID being replaced - BINARY_PATH="$HOME/.local/bin/{{.BINARY_NAME}}" MAINPID='$MAINPID' envsubst < ./build/unix/HATray.service > $HOME/.config/systemd/user/HATray.service - systemctl daemon-reload --user # - systemctl enable HATray --user - systemctl start HATray --user status: desc: "Show the status of the service" cmds: - systemctl status HATray --user tail: desc: "Tail the log file" cmds: - journalctl --user-unit HATray.service -ef