Skip to content

Commit ed2e0e2

Browse files
committed
fix: correct version string for development builds
- Use git describe --exact-match to detect tagged commits - Check for dirty working tree with git status --porcelain - Use tag version ONLY if exact match AND clean working tree - Otherwise fallback to v0.0.0-dev+<commit-hash> format - Fixes issue where development builds showed old release tags
1 parent ddf69bb commit ed2e0e2

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

Makefile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,19 @@ YEAR_GEN := $(shell date '+%Y')
2121

2222
GOBIN := $(shell go env GOPATH)/bin
2323
GIT_COMMIT := $(shell git rev-parse --short HEAD)
24-
# Use git describe to get semantic version, fallback to commit hash for dev builds
25-
VERSION := $(shell git describe --tags --match='v*' --abbrev=0 2>/dev/null || echo "v0.0.0-dev+${GIT_COMMIT}")
24+
GIT_TAG := $(shell git describe --tags --exact-match 2>/dev/null)
25+
DIRTY := $(shell git status --porcelain)
26+
27+
# Version logic:
28+
# - Use tag ONLY if exact match AND clean working tree
29+
# - Otherwise fallback to dev version
30+
ifeq ($(GIT_TAG),)
31+
VERSION := v0.0.0-dev+$(GIT_COMMIT)
32+
else ifneq ($(DIRTY),)
33+
VERSION := v0.0.0-dev+$(GIT_COMMIT)
34+
else
35+
VERSION := $(GIT_TAG)
36+
endif
2637

2738
export KPT_FN_WASM_RUNTIME ?= nodejs
2839

0 commit comments

Comments
 (0)