Skip to content

Commit

Permalink
Append the number of commits since the last tag to the version (#17)
Browse files Browse the repository at this point in the history
Co-authored-by: Jim Weinert <jweinert@digitalocean.com>
  • Loading branch information
countingtoten and Jim Weinert committed Oct 26, 2021
1 parent ee2508f commit 7cbe430
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
.PHONY: build test test-short vendor

latest_tag := $(shell git describe --tags --abbrev=0)
commits_since_tag := $(shell git rev-list ${latest_tag}..HEAD --count)
# TODO: append commits_since_tag to the version if commits_since_tag is not 0
version := ${latest_tag}

commits_since_tag := $(shell git rev-list ${latest_tag}..HEAD --count)
ifneq (${commits_since_tag}, 0)
version = ${latest_tag}-${commits_since_tag}
endif

go_ldflags := "-X main.Version=${version}"

build: vendor
Expand Down

0 comments on commit 7cbe430

Please sign in to comment.