@@ -26,29 +26,29 @@ if [[ -n "${CODER_FORCE_VERSION:-}" ]]; then
26
26
exit 0
27
27
fi
28
28
29
- # To make contributing easier, if the upstream isn't coder/coder and there are
30
- # no tags we will fall back to 0.1.0 with devel suffix.
31
- remote_url= $( git remote get-url origin )
29
+
30
+ # To make contributing easier, if there are no tags, we'll use a default
31
+ # version.
32
32
tag_list=$( git tag)
33
- if ! [[ ${remote_url} =~ [@/]github.com ]] && ! [[ ${remote_url} =~ [:/]coder/coder( \. git) ? $ ]] && [[ -z ${tag_list} ]]; then
34
- log
35
- log " INFO(version.sh): It appears you've checked out a fork of Coder."
36
- log " INFO(version.sh): By default GitHub does not include tags when forking."
37
- log " INFO(version.sh): We will use the default version 2.0.0 for this build."
38
- log " INFO(version.sh): To pull tags from upstream, use the following commands:"
39
- log " INFO(version.sh): - git remote add upstream https://github.com/coder/coder.git"
40
- log " INFO(version.sh): - git fetch upstream"
41
- log
42
- last_tag=" v2.0.0"
33
+ if [[ -z ${tag_list} ]]; then
34
+ log
35
+ log " INFO(version.sh): It appears you've checked out a fork or shallow clone of Coder."
36
+ log " INFO(version.sh): By default GitHub does not include tags when forking."
37
+ log " INFO(version.sh): We will use the default version 2.0.0 for this build."
38
+ log " INFO(version.sh): To pull tags from upstream, use the following commands:"
39
+ log " INFO(version.sh): - git remote add upstream https://github.com/coder/coder.git"
40
+ log " INFO(version.sh): - git fetch upstream"
41
+ log
42
+ last_tag=" v2.0.0"
43
43
else
44
- 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
44
+ 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
52
fi
53
53
54
54
version=" ${last_tag} "
0 commit comments