diff --git a/.gitignore b/.gitignore index f36a48ff..bfb89385 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ coverage.html *.cache /coverage.txt bin/ +dist/ tasks /core diff --git a/Taskfile.yml b/Taskfile.yml index 12b48729..de548953 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -1,16 +1,21 @@ version: '3' +vars: + VERSION: + sh: git describe --tags --exact-match 2>/dev/null || echo "dev" + LDFLAGS: "-X github.com/host-uk/core/pkg/cli.AppVersion={{.VERSION}}" + tasks: # --- CLI Management --- cli:build: desc: "Build core CLI to ./bin/core" cmds: - - go build -o ./bin/core . + - go build -ldflags '{{.LDFLAGS}}' -o ./bin/core . cli:install: desc: "Install core CLI to system PATH" cmds: - - go install . + - go install -ldflags '{{.LDFLAGS}}' . # --- Development --- test: