Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ba7d183 commit 242f46eCopy full SHA for 242f46e
scripts/version.sh
@@ -41,7 +41,14 @@ if ! [[ ${remote_url} =~ [@/]github.com ]] && ! [[ ${remote_url} =~ [:/]coder/co
41
log
42
last_tag="v2.0.0"
43
else
44
- last_tag="$(git describe --tags --abbrev=0)"
+ current_commit=$(git rev-parse HEAD)
45
+ # Try to find the last tag that contains the current commit
46
+ last_tag=$(git tag --contains ${current_commit} --sort=version:refname | head -n 1)
47
+ # If there is no tag that contains the current commit,
48
+ # get the latest tag sorted by semver.
49
+ if [[ -z "${last_tag}" ]]; then
50
+ last_tag=$(git tag --sort=version:refname | tail -n 1)
51
+ fi
52
fi
53
54
version="${last_tag}"
0 commit comments