Skip to content

Commit 3cca30c

Browse files
authored
chore: make version.sh work in forks (coder#6993)
1 parent 34593e3 commit 3cca30c

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

scripts/version.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,22 @@ if [[ "${CODER_FORCE_VERSION:-}" != "" ]]; then
2020
exit 0
2121
fi
2222

23-
last_tag="$(git describe --tags --abbrev=0)"
23+
# To make contributing easier, if the upstream isn't coder/coder and there are
24+
# no tags we will fall back to 0.1.0 with devel suffix.
25+
if [[ "$(git remote get-url origin)" != *coder/coder* ]] && [[ "$(git tag)" == "" ]]; then
26+
log
27+
log "INFO(version.sh): It appears you've checked out a fork of Coder."
28+
log "INFO(version.sh): By default GitHub does not include tags when forking."
29+
log "INFO(version.sh): We will use the default version 0.1.0 for this build."
30+
log "INFO(version.sh): To pull tags from upstream, use the following commands:"
31+
log "INFO(version.sh): - git remote add upstream https://github.com/coder/coder.git"
32+
log "INFO(version.sh): - git fetch upstream"
33+
log
34+
last_tag="v0.1.0"
35+
else
36+
last_tag="$(git describe --tags --abbrev=0)"
37+
fi
38+
2439
version="$last_tag"
2540

2641
# If the HEAD has extra commits since the last tag then we are in a dev version.

0 commit comments

Comments
 (0)