Skip to content

Commit 4a94e25

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

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

.github/workflows/release.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
run: |
7979
set -euxo pipefail
8080
81-
# build and push Docker images for each architecture
81+
# build and (maybe) push Docker images for each architecture
8282
images=()
8383
for arch in amd64 armv7 arm64; do
8484
img="$(
@@ -90,18 +90,25 @@ jobs:
9090
images+=("$img")
9191
done
9292
93+
# we can't build multi-arch if the images aren't pushed, so quit now
94+
# if dry-running
95+
if [[ "$CODER_RELEASE" != *t* ]]; then
96+
echo Skipping multi-arch docker builds due to dry-run.
97+
exit 0
98+
fi
99+
93100
# build and push multi-arch manifest
94101
./scripts/build_docker_multiarch.sh \
95-
${{ (!github.event.inputs.dry_run && !github.event.inputs.snapshot) && '--push' || '' }} \
102+
--push \
96103
"${images[@]}"
97104
98105
# if the current version is equal to the highest (according to semver)
99106
# version in the repo, also create a multi-arch image as ":latest" and
100107
# push it
101108
if [[ "$(git tag | grep '^v' | grep -vE '(rc|dev|-|\+|\/)' | sort -r --version-sort | head -n1)" == "v$(./scripts/version.sh)" ]]; then
102109
./scripts/build_docker_multiarch.sh \
110+
--push \
103111
--target "$(./scripts/image_tag.sh --version latest)" \
104-
${{ (!github.event.inputs.dry_run && !github.event.inputs.snapshot) && '--push' || '' }} \
105112
"${images[@]}"
106113
fi
107114

scripts/publish_release.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ if [[ "${#files[@]}" == 0 ]]; then
7171
error "No files supplied"
7272
fi
7373

74+
if [[ "$dry_run" == 0 ]] && [[ "$version" == *dev* ]]; then
75+
error "Cannot publish a dev version to GitHub"
76+
fi
77+
7478
# The git commands need to be executed from within the repository.
7579
cdroot
7680

scripts/version.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@ set -euo pipefail
1515
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
1616
cdroot
1717

18-
version="$(git describe --tags --abbrev=0)"
18+
last_tag="$(git describe --tags --abbrev=0)"
19+
version="$last_tag"
1920

2021
# If the HEAD has extra commits since the last tag then we are in a dev version.
2122
#
2223
# Dev versions are denoted by the "-devel+" suffix with a trailing commit short
2324
# SHA.
2425
if [[ "${CODER_RELEASE:-}" == *t* ]]; then
25-
# $version will equal `git describe --always` if we currently have the tag
26+
# $last_tag will equal `git describe --always` if we currently have the tag
2627
# checked out.
27-
if [[ "$version" != "$(git describe --always)" ]]; then
28+
if [[ "$last_tag" != "$(git describe --always)" ]]; then
2829
# make won't exit on $(shell cmd) failures, so we have to kill it :(
2930
if [[ "$(ps -o comm= "$PPID" || true)" == *make* ]]; then
3031
log "ERROR: version.sh attemped to generate a dev version string when CODER_RELEASE was set"

0 commit comments

Comments
 (0)