Skip to content

Commit

Permalink
add version
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Molik committed Jan 1, 2024
1 parent fb381b1 commit 6a8e4d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ else
GOBIN=$(shell go env GOBIN)
endif


VERSION ?= $(shell if [ ! -z $$(git tag --points-at HEAD) ] ; then git tag --points-at HEAD|cat ; else git rev-parse --short HEAD|cat; fi )
SHA ?= $(shell git rev-parse --short HEAD)
# Setting SHELL to bash allows bash commands to be executed by recipes.
# This is a requirement for 'setup-envtest.sh' in the test target.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
Expand Down Expand Up @@ -68,7 +71,7 @@ test: generate fmt vet envtest ## Run tests.
build: fmt vet bin/manager

bin/manager: $(SRC)
CGO_ENABLED=0 go build -v -ldflags '-s -w' -o $@ main/main.go
CGO_ENABLED=0 go build -v -ldflags "-s -w -X github.com/$(OWNER)/$(REPO).Version=$(VERSION)" -o $@ main/main.go

.PHONY: run-local
run-local: build-quick
Expand Down
4 changes: 4 additions & 0 deletions version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package automent

var Version string
var Build string

0 comments on commit 6a8e4d9

Please sign in to comment.