This repository was archived by the owner on Jun 28, 2022. It is now read-only.
File tree 1 file changed +12
-3
lines changed 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -29,11 +29,20 @@ COMMITS_SINCE_LAST_TAG=`git rev-list ${COMMIT_WITH_LAST_TAG}..HEAD --count`
29
29
BUILD_METADATA=` git rev-parse --short=8 HEAD`
30
30
DIRTY_AFFIX=$( git diff --quiet || echo ' -dirty' )
31
31
32
+ # strip leading v from git tag, see:
33
+ # https://github.com/golang/go/issues/32945
34
+ # https://semver.org/#is-v123-a-semantic-version
35
+ if [[ " $SHORT_TAG " == v* ]]; then
36
+ SEMVER_TAG=" ${SHORT_TAG: 1} "
37
+ else
38
+ SEMVER_TAG=" ${SHORT_TAG} "
39
+ fi
40
+
32
41
if [[ " $LONG_TAG " == " $SHORT_TAG " ]] ; then # the current commit is tagged as a release
33
- echo " ${SHORT_TAG }${DIRTY_AFFIX} "
42
+ echo " ${SEMVER_TAG }${DIRTY_AFFIX} "
34
43
elif [[ " $SHORT_TAG " != * -* ]] ; then # the current ref is a decendent of a regular version
35
44
SHORT_TAG=$( increment_patch ${SHORT_TAG} )
36
- echo " $SHORT_TAG -dev.${COMMITS_SINCE_LAST_TAG} +${BUILD_METADATA}${DIRTY_AFFIX} "
45
+ echo " $SEMVER_TAG -dev.${COMMITS_SINCE_LAST_TAG} +${BUILD_METADATA}${DIRTY_AFFIX} "
37
46
else # the current ref is a decendent of a pre-release version (e.g. rc, alpha, or beta)
38
- echo " $SHORT_TAG .${COMMITS_SINCE_LAST_TAG} +${BUILD_METADATA}${DIRTY_AFFIX} "
47
+ echo " $SEMVER_TAG .${COMMITS_SINCE_LAST_TAG} +${BUILD_METADATA}${DIRTY_AFFIX} "
39
48
fi
You can’t perform that action at this time.
0 commit comments