Derive build version from git tags via VERSION file.
flake.nix reads from VERSION instead of hardcoding; Makefile gains a version target that syncs VERSION from the latest git tag and injects it into go build ldflags. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
9
Makefile
9
Makefile
@@ -1,4 +1,6 @@
|
||||
.PHONY: proto build test lint clean
|
||||
VERSION := $(shell git describe --tags --abbrev=0 | sed 's/^v//')
|
||||
|
||||
.PHONY: proto build test lint clean version
|
||||
|
||||
proto:
|
||||
protoc \
|
||||
@@ -7,8 +9,11 @@ proto:
|
||||
-I proto \
|
||||
proto/sgard/v1/sgard.proto
|
||||
|
||||
version:
|
||||
@echo $(VERSION) > VERSION
|
||||
|
||||
build:
|
||||
go build ./...
|
||||
go build -ldflags "-X main.version=$(VERSION)" ./...
|
||||
|
||||
test:
|
||||
go test ./...
|
||||
|
||||
Reference in New Issue
Block a user