Skip to content

Commit 4b3608b

Browse files
authored
fix: run git fetch --tags --force during release (#2495)
1 parent dc11568 commit 4b3608b

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

.github/workflows/release.yaml

+27-3
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,22 @@ env:
2727
jobs:
2828
linux-windows:
2929
runs-on: ubuntu-latest
30+
env:
31+
# Necessary for Docker manifest
32+
DOCKER_CLI_EXPERIMENTAL: "enabled"
3033
steps:
3134
- uses: actions/checkout@v3
3235
with:
3336
fetch-depth: 0
3437

38+
# If the event that triggered the build was an annotated tag (which our
39+
# tags are supposed to be), actions/checkout has a bug where the tag in
40+
# question is only a lightweight tag and not a full annotated tag. This
41+
# command seems to fix it.
42+
# https://github.com/actions/checkout/issues/290
43+
- name: Fetch git tags
44+
run: git fetch --tags --force
45+
3546
- uses: actions/setup-go@v3
3647
with:
3748
go-version: "~1.18"
@@ -133,6 +144,14 @@ jobs:
133144
with:
134145
fetch-depth: 0
135146

147+
# If the event that triggered the build was an annotated tag (which our
148+
# tags are supposed to be), actions/checkout has a bug where the tag in
149+
# question is only a lightweight tag and not a full annotated tag. This
150+
# command seems to fix it.
151+
# https://github.com/actions/checkout/issues/290
152+
- name: Fetch git tags
153+
run: git fetch --tags --force
154+
136155
- uses: actions/setup-go@v3
137156
with:
138157
go-version: "~1.18"
@@ -210,14 +229,19 @@ jobs:
210229
needs:
211230
- linux-windows
212231
- darwin
213-
env:
214-
# Necessary for Docker manifest
215-
DOCKER_CLI_EXPERIMENTAL: "enabled"
216232
steps:
217233
- uses: actions/checkout@v3
218234
with:
219235
fetch-depth: 0
220236

237+
# If the event that triggered the build was an annotated tag (which our
238+
# tags are supposed to be), actions/checkout has a bug where the tag in
239+
# question is only a lightweight tag and not a full annotated tag. This
240+
# command seems to fix it.
241+
# https://github.com/actions/checkout/issues/290
242+
- name: Fetch git tags
243+
run: git fetch --tags --force
244+
221245
- name: Docker Login
222246
uses: docker/login-action@v2
223247
with:

scripts/version.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ if [[ "${CODER_RELEASE:-}" == *t* ]]; then
2828
if [[ "$last_tag" != "$(git describe --always)" ]]; then
2929
# make won't exit on $(shell cmd) failures, so we have to kill it :(
3030
if [[ "$(ps -o comm= "$PPID" || true)" == *make* ]]; then
31-
log "ERROR: version.sh attemped to generate a dev version string when CODER_RELEASE was set"
31+
log "ERROR: version.sh: the current commit is not tagged with an annotated tag"
3232
kill "$PPID" || true
3333
exit 1
3434
fi
3535

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

0 commit comments

Comments
 (0)