Provide cli version as git hash from makefile

This commit is contained in:
RamiBerm 2021-05-11 09:33:11 +03:00
parent ff937e8160
commit cc60ad064c
2 changed files with 5 additions and 3 deletions

View File

@ -1,16 +1,17 @@
FOLDER=$(GOOS).$(GOARCH)
COMMIT_HASH=$(shell git rev-parse HEAD)
.PHONY: help
.DEFAULT_GOAL := help
help: ## This help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
install:
go install mizu.go
build: ## build mizu CLI binary (select platform via GOOS / GOARCH env variables)
go build -o bin/$(FOLDER)/mizu mizu.go
go build -ldflags="-X 'github.com/up9inc/mizu/cli/mizu.Version=$(COMMIT_HASH)'" -o bin/$(FOLDER)/mizu mizu.go
build-all: ## build for all supported platforms
@echo "Compiling for every OS and Platform"

View File

@ -1,6 +1,7 @@
package mizu
var Version = "development" // this var is overridden using ldflags in makefile when building
const (
Version = "0.1.0"
MizuResourcesNamespace = "default"
)