Skip to content

Commit 103db74

Browse files
committed
Use source version for local builds
1 parent 10a15ee commit 103db74

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
# This Makefile demonstrates how to build GABS with version information
33

44
# Version information
5-
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
5+
# Use the declared source version for local builds so rebuilt workspace binaries
6+
# keep the release semantic version instead of inheriting a git "-dirty" suffix.
7+
SOURCE_VERSION ?= $(shell sed -n 's/^[[:space:]]*Version = "\([^"]*\)".*/\1/p' internal/version/version.go | head -n 1)
8+
VERSION ?= $(if $(SOURCE_VERSION),v$(SOURCE_VERSION),dev)
69
COMMIT ?= $(shell git rev-parse HEAD 2>/dev/null || echo "unknown")
710
BUILD_DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
811

@@ -44,6 +47,7 @@ install:
4447
# Show version information that would be embedded
4548
.PHONY: version-info
4649
version-info:
50+
@echo "Source Version: $(SOURCE_VERSION)"
4751
@echo "Version: $(VERSION)"
4852
@echo "Commit: $(COMMIT)"
4953
@echo "Build Date: $(BUILD_DATE)"

0 commit comments

Comments
 (0)