mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
chore: always use the latest released version tag when building (#13556)
* chore: always use the latest released version tag when building * Update version.sh Co-authored-by: Dean Sheather <dean@deansheather.com> --------- Co-authored-by: Dean Sheather <dean@deansheather.com>
This commit is contained in:
+8
-1
@@ -41,7 +41,14 @@ if ! [[ ${remote_url} =~ [@/]github.com ]] && ! [[ ${remote_url} =~ [:/]coder/co
|
||||
log
|
||||
last_tag="v2.0.0"
|
||||
else
|
||||
last_tag="$(git describe --tags --abbrev=0)"
|
||||
current_commit=$(git rev-parse HEAD)
|
||||
# Try to find the last tag that contains the current commit
|
||||
last_tag=$(git tag --contains "$current_commit" --sort=version:refname | head -n 1)
|
||||
# If there is no tag that contains the current commit,
|
||||
# get the latest tag sorted by semver.
|
||||
if [[ -z "${last_tag}" ]]; then
|
||||
last_tag=$(git tag --sort=version:refname | tail -n 1)
|
||||
fi
|
||||
fi
|
||||
|
||||
version="${last_tag}"
|
||||
|
||||
Reference in New Issue
Block a user