Skip to content

Commit 0907c37

Browse files
committed
fixup! chore: integrate docker into pipeline
1 parent a0c9a96 commit 0907c37

File tree

2 files changed

+18
-22
lines changed

2 files changed

+18
-22
lines changed

.github/workflows/release.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,8 @@ on:
2121
type: boolean
2222
required: true
2323

24-
# In a non-snapshot we want the ./scripts/version.sh script to never generate a
25-
# +dev version.
2624
env:
27-
CODER_FORCE_DEV_VERSION: ${{ github.event.inputs.snapshot && 'true' || 'false' }}
28-
CODER_NO_DEV_VERSION: ${{ github.event.inputs.snapshot && 'false' || 'true' }}
25+
CODER_RELEASE: ${{ github.event.inputs.snapshot && 'false' || 'true' }}
2926

3027
jobs:
3128
linux-windows:
@@ -79,14 +76,14 @@ jobs:
7976
8077
- name: Build Linux Docker images
8178
run: |
82-
set -euo pipefail
79+
set -euxo pipefail
8380
8481
# build and push Docker images for each architecture
8582
images=()
8683
for arch in amd64 armv7 arm64; do
8784
img="$(
8885
./scripts/build_docker.sh \
89-
${{ !github.event.inputs.dry_run && !github.event.inputs.snapshot && '--push' }} \
86+
${{ (!github.event.inputs.dry_run && !github.event.inputs.snapshot) && '--push' || '' }} \
9087
--arch "$arch" \
9188
./dist/coder_*_linux_"$arch"
9289
)"
@@ -95,7 +92,7 @@ jobs:
9592
9693
# build and push multi-arch manifest
9794
./scripts/build_docker_multiarch.sh \
98-
${{ !github.event.inputs.dry_run && !github.event.inputs.snapshot && '--push' }} \
95+
${{ (!github.event.inputs.dry_run && !github.event.inputs.snapshot) && '--push' || '' }} \
9996
"${images[@]}"
10097
10198
# if the current version is equal to the highest (according to semver)
@@ -104,7 +101,7 @@ jobs:
104101
if [[ "$(git tag | grep '^v' | grep -vE '(rc|dev|-|\+|\/)' | sort -r --version-sort | head -n1)" == "v$(./scripts/version.sh)" ]]; then
105102
./scripts/build_docker_multiarch.sh \
106103
--target "$(./scripts/image_tag.sh --version latest)" \
107-
${{ !github.event.inputs.dry_run && !github.event.inputs.snapshot && '--push' }} \
104+
${{ (!github.event.inputs.dry_run && !github.event.inputs.snapshot) && '--push' || '' }} \
108105
"${images[@]}"
109106
fi
110107

scripts/version.sh

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,37 @@
44
# versions. Note: the version returned by this script will NOT include the "v"
55
# prefix that is included in the Git tag.
66
#
7-
# If $CODER_FORCE_DEV_VERSION is set to "true", the returned version will be a
8-
# dev version even if the current commit is tagged.
7+
# If $CODER_RELEASE is set to "true", the returned version will equal the
8+
# current git tag. If the current commit is not tagged, this will fail.
99
#
10-
# If $CODER_NO_DEV_VERSION is set to "true", the script will fail if the current
11-
# commit is not tagged.
10+
# If $CODER_RELEASE is not set, the returned version will always be a dev
11+
# version.
1212

1313
set -euo pipefail
1414
# shellcheck source=scripts/lib.sh
1515
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
1616
cdroot
1717

18-
# $current will equal $last_tag if we currently have the tag checked out.
19-
last_tag="$(git describe --tags --abbrev=0)"
20-
current="$(git describe --always)"
21-
22-
version="$last_tag"
18+
version="$(git describe --tags --abbrev=0)"
2319

2420
# If the HEAD has extra commits since the last tag then we are in a dev version.
2521
#
2622
# Dev versions are denoted by the "-devel+" suffix with a trailing commit short
2723
# SHA.
28-
if [[ "${CODER_FORCE_DEV_VERSION:-}" == *t* ]] || [[ "$last_tag" != "$current" ]]; then
29-
if [[ "${CODER_NO_DEV_VERSION:-}" == *t* ]]; then
30-
# make won't exit on $(shell cmd) failures :(
24+
if [[ "${CODER_RELEASE:-}" == *t* ]]; then
25+
# $version will equal `git describe --always` if we currently have the tag
26+
# checked out.
27+
if [[ "$version" != "$(git describe --always)" ]]; then
28+
# make won't exit on $(shell cmd) failures, so we have to kill it :(
3129
if [[ "$(ps -o comm= "$PPID" || true)" == *make* ]]; then
32-
log "ERROR: version.sh attemped to generate a dev version string when CODER_NO_DEV_VERSION was set"
30+
log "ERROR: version.sh attemped to generate a dev version string when CODER_RELEASE was set"
3331
kill "$PPID" || true
3432
exit 1
3533
fi
3634

37-
error "version.sh attemped to generate a dev version string when CODER_NO_DEV_VERSION was set"
35+
error "version.sh attemped to generate a dev version string when CODER_RELEASE was set"
3836
fi
37+
else
3938
version+="-devel+$(git rev-parse --short HEAD)"
4039
fi
4140

0 commit comments

Comments
 (0)