From 1ab56b05360a3e98092d91b5164e4ef647866d92 Mon Sep 17 00:00:00 2001 From: Micheal Wilkinson Date: Sat, 21 Mar 2026 23:00:05 +0000 Subject: [PATCH] chore(workflows): allow release builds without upx --- .gitea/workflows/release.yml | 14 +++++++++----- .gitea/workflows/update-release.yml | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index f51fe73..add4f8a 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -43,7 +43,9 @@ jobs: run: | set -euo pipefail apt-get update - apt-get install -y upx-ucl || apt-get install -y upx + if ! apt-get install -y upx-ucl && ! apt-get install -y upx; then + echo "UPX package install failed; release binaries will be uploaded uncompressed." >&2 + fi - name: Validate formatting run: test -z "$(gofmt -l .)" @@ -248,13 +250,13 @@ jobs: run: | set -euo pipefail + upx_cmd="" if command -v upx >/dev/null 2>&1; then upx_cmd=upx elif command -v upx-ucl >/dev/null 2>&1; then upx_cmd=upx-ucl else - echo "UPX is not available on PATH after installation." >&2 - exit 1 + echo "UPX is not available on PATH; continuing without binary compression." >&2 fi mkdir -p dist @@ -265,7 +267,9 @@ jobs: bin="vociferate_${RELEASE_VERSION}_${os}_${arch}" GOOS="$os" GOARCH="$arch" go build -trimpath -ldflags="-s -w" -o "dist/${bin}" ./cmd/vociferate - "${upx_cmd}" --best --lzma "dist/${bin}" + if [[ -n "${upx_cmd}" ]]; then + "${upx_cmd}" --best --lzma "dist/${bin}" + fi done ( @@ -345,7 +349,7 @@ jobs: echo "- Tag: ${TAG_NAME}" echo "- Release notes sourced from changelog entry ${RELEASE_VERSION}." echo "- Published assets: vociferate_${RELEASE_VERSION}_linux_amd64, vociferate_${RELEASE_VERSION}_linux_arm64, checksums.txt" - echo "- Release binaries were compressed with UPX before upload." + echo "- Release binaries are compressed with UPX when available, otherwise uploaded uncompressed." } >> "$SUMMARY_FILE" else { diff --git a/.gitea/workflows/update-release.yml b/.gitea/workflows/update-release.yml index 393a66d..053f31e 100644 --- a/.gitea/workflows/update-release.yml +++ b/.gitea/workflows/update-release.yml @@ -126,7 +126,9 @@ jobs: run: | set -euo pipefail apt-get update - apt-get install -y upx-ucl || apt-get install -y upx + if ! apt-get install -y upx-ucl && ! apt-get install -y upx; then + echo "UPX package install failed; release binaries will be uploaded uncompressed." >&2 + fi - name: Preflight release API access env: @@ -170,13 +172,13 @@ jobs: run: | set -euo pipefail + upx_cmd="" if command -v upx >/dev/null 2>&1; then upx_cmd=upx elif command -v upx-ucl >/dev/null 2>&1; then upx_cmd=upx-ucl else - echo "UPX is not available on PATH after installation." >&2 - exit 1 + echo "UPX is not available on PATH; continuing without binary compression." >&2 fi mkdir -p dist @@ -187,7 +189,9 @@ jobs: bin="vociferate_${RELEASE_VERSION}_${os}_${arch}" GOOS="$os" GOARCH="$arch" go build -trimpath -ldflags="-s -w" -o "dist/${bin}" ./cmd/vociferate - "${upx_cmd}" --best --lzma "dist/${bin}" + if [[ -n "${upx_cmd}" ]]; then + "${upx_cmd}" --best --lzma "dist/${bin}" + fi done ( @@ -267,7 +271,7 @@ jobs: echo "- Tag: ${TAG_NAME}" echo "- Release notes sourced from changelog entry ${RELEASE_VERSION}." echo "- Published assets: vociferate_${RELEASE_VERSION}_linux_amd64, vociferate_${RELEASE_VERSION}_linux_arm64, checksums.txt" - echo "- Release binaries were compressed with UPX before upload." + echo "- Release binaries are compressed with UPX when available, otherwise uploaded uncompressed." } >> "$SUMMARY_FILE" else {