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 b1f17f4Copy full SHA for b1f17f4
scripts/version.sh
@@ -41,7 +41,16 @@ 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_branch=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD)
45
+ # When working from the `main` branch we assume that the latest
46
+ # tag is the most recent release. We don't always release from
47
+ # the main branch, so using `git describe --tags` doesn't work
48
+ # for this scenario.
49
+ if [[ "${current_branch}" == "main" ]]; then
50
+ last_tag=$(git tag -l --sort=version:refname | tail -n 1)
51
+ else
52
+ last_tag="$(git describe --tags --abbrev=0)"
53
+ fi
54
fi
55
56
version="${last_tag}"
0 commit comments