diff --git a/Makefile b/Makefile index ed9db3995..aa9acdb3f 100755 --- a/Makefile +++ b/Makefile @@ -89,7 +89,7 @@ endif ifndef ALT_RELEASE # Default release labeling. (This may fail and give inconsistent results due to the fact that # travis does a shallow clone.) -LATEST_RELEASE=$(shell git tag | grep RELEASE_ | sort | tail -1) +LATEST_RELEASE=$(shell git tag | grep RELEASE_ | sort -n -t V -k 2,2 | tail -1) # use egrep to count lines instead of wc to avoid whitespace error on Mac COMMITS_SINCE_RELEASE=$(shell git log --oneline $(LATEST_RELEASE)..HEAD | egrep -c .) ifneq ($(COMMITS_SINCE_RELEASE),0) diff --git a/scripts/common.py b/scripts/common.py index 297be00d1..c1ed333b0 100644 --- a/scripts/common.py +++ b/scripts/common.py @@ -408,7 +408,7 @@ def get_version(): alt_release = os.getenv("ALT_RELEASE") if alt_release == None: # Default release labeling based on commits since last release tag - latest_release = subprocess.check_output('git tag | grep RELEASE_ | sort | tail -1', shell=True).strip() + latest_release = subprocess.check_output('git tag | grep RELEASE_ | sort -n -t V -k 2,2 | tail -1', shell=True).strip() commits_since_release = subprocess.check_output('git log --oneline '+latest_release.decode("utf-8")+'..HEAD | wc -l', shell=True).decode("utf-8").strip() else: # Alternate release labeling with fork name (in ALT_RELEASE env var) plus branch