From 337953d1afb815536365dc3c7dff39c1fd13eb81 Mon Sep 17 00:00:00 2001 From: Evan Hearne Date: Thu, 23 May 2024 09:26:04 +0100 Subject: [PATCH] added make target for adding git commit hash as version --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 2a23925..0845932 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,7 @@ test: fmt vet $(GINKGO) ## install: Build and install kuadrantctl binary ($GOBIN or GOPATH/bin) .PHONY : install install: fmt vet + $(MAKE) update-version GOBIN=$(PROJECT_PATH)/bin $(GO) install .PHONY: prepare-local-cluster @@ -74,5 +75,10 @@ fmt: vet: $(GO) vet ./... +.PHONY: update-version +update-version: + @commit_hash=$$(git rev-parse --short=7 HEAD); \ + sed -i.bak 's/Version = "v0.0.0"/Version = "dev - '$${commit_hash}'"/' version/version.go && rm version/version.go.bak + # Include last to avoid changing MAKEFILE_LIST used above include ./make/*.mk