Skip to content

Commit 317e80d

Browse files
committed
chore: fix release makefile stuff
1 parent c7317f4 commit 317e80d

File tree

3 files changed

+37
-13
lines changed

3 files changed

+37
-13
lines changed

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ jobs:
198198
make -j \
199199
build/coder_"$version"_darwin_{amd64,arm64}.zip
200200
env:
201-
CODER_SIGN_DARWIN: "true"
201+
CODER_SIGN_DARWIN: "1"
202202
AC_USERNAME: ${{ secrets.AC_USERNAME }}
203203
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
204204
AC_APPLICATION_IDENTITY: BDB050EB749EDD6A80C6F119BF1382ECA119CCCC

Makefile

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# - build-fat: builds all "fat" binaries for all architectures
66
# - build-slim: builds all "slim" binaries (no frontend or slim binaries
77
# embedded) for all architectures
8+
# - release: simulate a release (mostly, does not push images)
89
# - build/coder(-slim)?_${os}_${arch}(.exe)?: build a single fat binary
910
# - build/coder_${os}_${arch}.(zip|tar.gz): build a release archive
1011
# - build/coder_linux_${arch}.(apk|deb|rpm): build a release Linux package
@@ -45,7 +46,7 @@ OS_ARCHES := \
4546
# Archive formats and their corresponding ${OS}_${ARCH} combos.
4647
ARCHIVE_TAR_GZ := linux_amd64 linux_arm64 linux_armv7
4748
ARCHIVE_ZIP := \
48-
darwin darwin_arm64 \
49+
darwin_amd64 darwin_arm64 \
4950
windows_amd64 windows_arm64
5051

5152
# All package formats we build and the ${OS}_${ARCH} combos we build them for.
@@ -87,6 +88,9 @@ build-slim bin: $(CODER_SLIM_BINARIES)
8788
build-fat build-full build: $(CODER_FAT_BINARIES)
8889
.PHONY: build-fat build-full build
8990

91+
release: $(CODER_FAT_BINARIES) $(CODER_ALL_ARCHIVES) $(CODER_ALL_PACKAGES) $(CODER_ALL_ARCH_IMAGES) build/coder_helm_$(VERSION).tgz
92+
.PHONY: release
93+
9094
build/coder-slim_$(VERSION)_checksums.sha1: $(CODER_SLIM_BINARIES)
9195
pushd ./build
9296
openssl dgst -r -sha1 coder-slim_"$(VERSION)"_* | tee "$(@F)"
@@ -216,14 +220,18 @@ $(CODER_ALL_ARCHIVES): $(CODER_FAT_BINARIES)
216220

217221
# This task builds all packages. It parses the target name to get the metadata
218222
# for the build, so it must be specified in this format:
219-
# build/coder_${version}_${os}_${arch}.${format}
223+
# build/coder_${version}_linux_${arch}.${format}
220224
#
221225
# Supports apk, deb, rpm for all linux targets.
222226
#
223-
# This depends on all fat binaries because it's difficult to do dynamic
224-
# dependencies due to the extensions in the filenames. These targets are
225-
# typically only used during release anyways.
226-
$(CODER_ALL_PACKAGES): $(CODER_FAT_BINARIES)
227+
# This depends on all Linux fat binaries and archives because it's difficult to
228+
# do dynamic dependencies due to the extensions in the filenames. These targets
229+
# are typically only used during release anyways.
230+
#
231+
# Packages need to run after the archives are built, otherwise they cause tar
232+
# errors like "file changed as we read it".
233+
CODER_PACKAGE_DEPS := $(foreach os_arch, $(PACKAGE_OS_ARCHES), build/coder_$(VERSION)_$(os_arch) build/coder_$(VERSION)_$(os_arch).tar.gz)
234+
$(CODER_ALL_PACKAGES): $(CODER_PACKAGE_DEPS)
227235
$(get-mode-os-arch-ext)
228236

229237
./scripts/package.sh \
@@ -252,7 +260,16 @@ $(CODER_ALL_NOVERSION_IMAGES_PUSHED): push/build/coder_%: push/build/coder_$(VER
252260
# build/coder_${version}_${os}_${arch}.tag
253261
#
254262
# Supports linux_amd64, linux_arm64, linux_armv7.
255-
$(CODER_ALL_ARCH_IMAGES): build/coder_$(VERSION)_%.tag: build/coder_$(VERSION)_%
263+
#
264+
# Images need to run after the archives and packages are built, otherwise they
265+
# cause errors like "file changed as we read it".
266+
$(CODER_ALL_ARCH_IMAGES): build/coder_$(VERSION)_%.tag: \
267+
build/coder_$(VERSION)_% \
268+
build/coder_$(VERSION)_%.apk \
269+
build/coder_$(VERSION)_%.deb \
270+
build/coder_$(VERSION)_%.rpm \
271+
build/coder_$(VERSION)_%.tar.gz
272+
256273
$(get-mode-os-arch-ext)
257274

258275
image_tag="$$(./scripts/image_tag.sh --arch "$$arch" --version "$(VERSION)")"

scripts/archive.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This script creates an archive containing the given binary renamed to
44
# `coder(.exe)?`, as well as the README.md and LICENSE files from the repo root.
55
#
6-
# Usage: ./archive.sh --format tar.gz [--output path/to/output.tar.gz] [--sign-darwin] [--agpl] path/to/binary
6+
# Usage: ./archive.sh --format tar.gz --os linux/darwin/windows [--output path/to/output.tar.gz] [--sign-darwin] [--agpl] path/to/binary
77
#
88
# The --format parameter must be set, and must either be "zip" or "tar.gz".
99
#
@@ -28,9 +28,10 @@ source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
2828
format=""
2929
output_path=""
3030
sign_darwin="${CODER_SIGN_DARWIN:-0}"
31+
os=""
3132
agpl="${CODER_BUILD_AGPL:-0}"
3233

33-
args="$(getopt -o "" -l format:,output:,sign-darwin,agpl -- "$@")"
34+
args="$(getopt -o "" -l format:,output:,sign-darwin,os:,agpl -- "$@")"
3435
eval set -- "$args"
3536
while true; do
3637
case "$1" in
@@ -47,10 +48,11 @@ while true; do
4748
output_path="$(realpath "$2")"
4849
shift 2
4950
;;
51+
--os)
52+
os="$2"
53+
shift 2
54+
;;
5055
--sign-darwin)
51-
if [[ "${AC_APPLICATION_IDENTITY:-}" == "" ]]; then
52-
error "AC_APPLICATION_IDENTITY must be set when --sign-darwin is supplied"
53-
fi
5456
sign_darwin=1
5557
shift
5658
;;
@@ -80,6 +82,11 @@ if [[ ! -f "$1" ]]; then
8082
fi
8183
input_file="$(realpath "$1")"
8284

85+
sign_darwin="$([[ "$sign_darwin" == 1 ]] && [[ "$os" == "darwin" ]] && echo 1 || echo 0)"
86+
if [[ "$sign_darwin" == 1 ]] && [[ "${AC_APPLICATION_IDENTITY:-}" == "" ]]; then
87+
error "AC_APPLICATION_IDENTITY must be set when --sign-darwin or CODER_SIGN_DARWIN=1 is supplied"
88+
fi
89+
8390
# Check dependencies
8491
if [[ "$format" == "zip" ]]; then
8592
dependencies zip

0 commit comments

Comments
 (0)