This commit is contained in:
James Read 2026-06-29 07:56:38 +00:00 committed by GitHub
commit 48232ada47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 38 additions and 8 deletions

View File

@ -3,21 +3,51 @@ set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
GORELEASER_CONFIG="${REPO_ROOT}/.goreleaser.yml"
TIMEOUT="${GORELEASER_TIMEOUT:-60m}"
ZIP_PATH="${REPO_ROOT}/dist/OliveTin-windows-amd64.zip"
if [[ -z "${VERSION:-}" ]]; then
echo "VERSION is required to build the Windows MSI" >&2
exit 1
fi
build_config="$(mktemp)"
trap 'rm -f "${build_config}"' EXIT
awk '/^checksum:/{print; print " disable: true"; next}1' "${GORELEASER_CONFIG}" > "${build_config}"
wait_for_stable_file() {
local file="${1}"
local last_size=-1
local stable_count=0
goreleaser release -f "${build_config}" --clean --timeout "${TIMEOUT}" --skip=publish "$@"
while [[ "${stable_count}" -lt 2 ]]; do
if [[ ! -f "${file}" ]]; then
stable_count=0
last_size=-1
sleep 1
continue
fi
local size
size="$(stat -c%s "${file}")"
if [[ "${size}" -gt 0 && "${size}" == "${last_size}" ]]; then
stable_count=$((stable_count + 1))
else
stable_count=0
fi
last_size="${size}"
sleep 1
done
}
goreleaser release --clean --timeout "${TIMEOUT}" "$@" &
goreleaser_pid=$!
while [[ ! -f "${ZIP_PATH}" ]]; do
if ! kill -0 "${goreleaser_pid}" 2>/dev/null; then
wait "${goreleaser_pid}"
echo "GoReleaser exited before Windows archive was created: ${ZIP_PATH}" >&2
exit 1
fi
sleep 1
done
wait_for_stable_file "${ZIP_PATH}"
"${SCRIPT_DIR}/build-msi.sh"
GORELEASER_SKIP_BUILD=1 goreleaser release --timeout "${TIMEOUT}" \
--skip=validate,before,archive,nfpm,docker,sign,sbom,announce "$@"
wait "${goreleaser_pid}"