File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -35,21 +35,23 @@ jobs:
3535 id : compute_version
3636 shell : bash
3737 run : |
38- # If this is a tag push and it starts with v, just use it
38+ # If this is a tag push and it starts with v, just use it and strip off the v
3939 if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
4040 Version="${GITHUB_REF#refs/tags/}"
41+ Version="${Version#v}"
4142 echo "version=$Version" >> $GITHUB_OUTPUT
4243 echo "detected tag push: $Version"
4344 exit 0
4445 fi
4546
46- # Otherwise find the latest tag that starts with v
47- LAST_TAG=$(git describe --tags --match "v*" --abbrev=0 2>/dev/null || echo "v0.0.0")
47+ # Otherwise find the latest tag that starts with v and strip off the v
48+ LAST_TAG=$(git describe --tags --match "v*" --abbrev=0 2>/dev/null || echo "v0.0.0")
49+ LAST_TAG="${LAST_TAG#v}"
4850
4951 # Compute a build number based on number of commits since that tag
5052 COMMITS_SINCE_TAG=$(git rev-list ${LAST_TAG}..HEAD --count)
5153
52- # Final version: vX .Y.Z+<build>
54+ # Final version: X .Y.Z
5355 Version="${LAST_TAG}.${COMMITS_SINCE_TAG}"
5456 echo "version=$Version" >> $GITHUB_OUTPUT
5557 echo "no tag push; using $Version"
You can’t perform that action at this time.
0 commit comments