Skip to content

fix: run git fetch --tags --force during release #2495

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 5 commits into from
Jun 19, 2022
Merged
Show file tree
Hide file tree
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
30 changes: 27 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,22 @@ env:
jobs:
linux-windows:
runs-on: ubuntu-latest
env:
# Necessary for Docker manifest
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

# If the event that triggered the build was an annotated tag (which our
# tags are supposed to be), actions/checkout has a bug where the tag in
# question is only a lightweight tag and not a full annotated tag. This
# command seems to fix it.
# https://github.com/actions/checkout/issues/290
- name: Fetch git tags
run: git fetch --tags --force

- uses: actions/setup-go@v3
with:
go-version: "~1.18"
Expand Down Expand Up @@ -133,6 +144,14 @@ jobs:
with:
fetch-depth: 0

# If the event that triggered the build was an annotated tag (which our
# tags are supposed to be), actions/checkout has a bug where the tag in
# question is only a lightweight tag and not a full annotated tag. This
# command seems to fix it.
# https://github.com/actions/checkout/issues/290
- name: Fetch git tags
run: git fetch --tags --force

- uses: actions/setup-go@v3
with:
go-version: "~1.18"
Expand Down Expand Up @@ -210,14 +229,19 @@ jobs:
needs:
- linux-windows
- darwin
env:
# Necessary for Docker manifest
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

# If the event that triggered the build was an annotated tag (which our
# tags are supposed to be), actions/checkout has a bug where the tag in
# question is only a lightweight tag and not a full annotated tag. This
# command seems to fix it.
# https://github.com/actions/checkout/issues/290
- name: Fetch git tags
run: git fetch --tags --force

- name: Docker Login
uses: docker/login-action@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions scripts/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ if [[ "${CODER_RELEASE:-}" == *t* ]]; then
if [[ "$last_tag" != "$(git describe --always)" ]]; then
# make won't exit on $(shell cmd) failures, so we have to kill it :(
if [[ "$(ps -o comm= "$PPID" || true)" == *make* ]]; then
log "ERROR: version.sh attemped to generate a dev version string when CODER_RELEASE was set"
log "ERROR: version.sh: the current commit is not tagged with an annotated tag"
kill "$PPID" || true
exit 1
fi

error "version.sh attemped to generate a dev version string when CODER_RELEASE was set"
error "version.sh: the current commit is not tagged with an annotated tag"
fi
else
version+="-devel+$(git rev-parse --short HEAD)"
Expand Down