q3rcon-proxy/Taskfile.yml
onyx-and-iris a70fdecdbb add --version flag
ensure version is injected at build time in Taskfile/makefile
2026-02-16 01:49:28 +00:00

80 lines
1.8 KiB
YAML

version: '3'
includes:
docker: ./docker/Taskfile.docker.yml
vars:
PROGRAM: q3rcon-proxy
SHELL: '{{if eq .OS "Windows_NT"}}powershell{{end}}'
BIN_DIR: bin
WINDOWS: '{{.BIN_DIR}}/{{.PROGRAM}}_windows_amd64.exe'
LINUX: '{{.BIN_DIR}}/{{.PROGRAM}}_linux_amd64'
MACOS: '{{.BIN_DIR}}/{{.PROGRAM}}_darwin_amd64'
VERSION:
sh: 'git describe --tags $(git rev-list --tags --max-count=1)'
tasks:
default:
desc: Build the q3rcon-proxy project
cmds:
- task: build
build:
desc: Build the q3rcon-proxy project
deps: [vet]
cmds:
- task: build-windows
- task: build-linux
- task: build-macos
vet:
desc: Vet the code
deps: [fmt]
cmds:
- go vet ./...
fmt:
desc: Fmt the code
cmds:
- go fmt ./...
build-windows:
desc: Build the q3rcon-proxy project for Windows
cmds:
- GOOS=windows GOARCH=amd64 go build -o {{.WINDOWS}} -ldflags="-X main.version={{.VERSION}}" ./cmd/{{.PROGRAM}}/
internal: true
build-linux:
desc: Build the q3rcon-proxy project for Linux
cmds:
- GOOS=linux GOARCH=amd64 go build -o {{.LINUX}} -ldflags="-X main.version={{.VERSION}}" ./cmd/{{.PROGRAM}}/
internal: true
build-macos:
desc: Build the q3rcon-proxy project for macOS
cmds:
- GOOS=darwin GOARCH=amd64 go build -o {{.MACOS}} -ldflags="-X main.version={{.VERSION}}" ./cmd/{{.PROGRAM}}/
internal: true
test:
desc: Run tests
cmds:
- go test ./...
clean:
desc: Clean the build artifacts
cmds:
- '{{.SHELL}} rm -r {{.BIN_DIR}}'
run:
desc: Run the q3rcon-proxy project
cmds:
- |
go run ./cmd/{{.PROGRAM}} \
--proxy-host=0.0.0.0 \
--target-host=localhost \
--ports-mapping=28961:28960 \
--session-timeout=20 \
--loglevel=debug