feat(build): inject version from git tag at build time
- Taskfile now injects AppVersion via ldflags - Shows git tag (e.g., v1.0.0) when built from a tag - Shows "dev" when built from non-tagged commit - Add dist/ to .gitignore for build artifacts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
fdc108c69e
commit
7d0a2fe7e5
2 changed files with 8 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -13,6 +13,7 @@ coverage.html
|
|||
*.cache
|
||||
/coverage.txt
|
||||
bin/
|
||||
dist/
|
||||
tasks
|
||||
/core
|
||||
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue