Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: make version.sh work in forks #6993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion scripts/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,22 @@ if [[ "${CODER_FORCE_VERSION:-}" != "" ]]; then
exit 0
fi

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

version="$last_tag"

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