Skip to content

Commit 74b0e8d

Browse files
committed
make: tag=#.#.# - prepends v
1 parent b04ac90 commit 74b0e8d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

GNUmakefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@ PROJECT_NAME := $(project)
114114
endif
115115
export PROJECT_NAME
116116

117+
ifeq ($(tag),)
118+
TAG :=$(shell git tag --sort=committerdate | grep -E '^v[0-9]' | tail -1)
119+
#TAG :=$(shell git describe --tags `git rev-list --tags --max-count=1`)
120+
else
121+
TAG :=v$(tag)
122+
endif
123+
export TAG
124+
117125
#GIT CONFIG
118126
GIT_USER_NAME := $(shell git config user.name)
119127
export GIT_USER_NAME
@@ -232,6 +240,13 @@ export PACKAGE_PREFIX
232240
#NOTE: 2 hashes are detected as 1st column output with color
233241
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?##/ {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
234242

243+
version:
244+
#get the most recent
245+
#@TAG=$(shell git tag --sort=committerdate | grep -E '^v[0-9]' | tail -1)
246+
#@TAG=$(shell git describe --tags `git rev-list --tags --max-count=1`)
247+
#@export TAG
248+
@echo $(TAG)
249+
235250
.PHONY: help
236251
help:## print verbose help
237252
@echo 'make [COMMAND] [EXTRA_ARGUMENTS] '
@@ -306,6 +321,7 @@ report:## print environment arguments
306321
@echo ' [ARGUMENTS] '
307322
@echo ' args:'
308323
@echo ' - PROJECT_NAME=${PROJECT_NAME}'
324+
@echo ' - TAG=${TAG}'
309325
@echo ' - HOME=${HOME}'
310326
@echo ' - PWD=${PWD}'
311327
@echo ' - PYTHON=${PYTHON}'

0 commit comments

Comments
 (0)