#!/bin/bash # Build de-branded versitygw release artifacts from the patched source # tree using upstream's GoReleaser config. Artifacts land in # /dist/. Run ci/clone-source.sh and ci/apply-patches.sh first. # # We keep upstream's artifact names: the binary stays `versitygw` and # the deb/rpm packages stay `versitygw` — only the embedded web UI is # de-branded. So upstream's .goreleaser.yaml is used unmodified. # # Environment: # VGW_SRC_DIR patched source tree (default: src) # VGW_TAG upstream tag -> release version (required) # GORELEASER goreleaser binary (default: goreleaser) set -euo pipefail VGW_SRC_DIR="${VGW_SRC_DIR:-src}" : "${VGW_TAG:?VGW_TAG must be set}" GORELEASER="${GORELEASER:-goreleaser}" SRC="$(cd "${VGW_SRC_DIR}" && pwd)" cd "${SRC}" if ! command -v "${GORELEASER}" >/dev/null 2>&1; then echo "ERROR: '${GORELEASER}' not found in PATH." >&2 echo " Install from https://goreleaser.com or set \$GORELEASER." >&2 exit 1 fi # The tree carries downstream patch commits on top of the tag, so HEAD # is no longer exactly the tag. Pin the version GoReleaser stamps and # skip the clean-tree / tag validations. export GORELEASER_CURRENT_TAG="${VGW_TAG}" echo ">>> building ${VGW_TAG} with $("${GORELEASER}" --version | head -1)..." "${GORELEASER}" release --clean --skip=validate,publish echo ">>> artifacts in ${SRC}/dist:" ls -1 dist/*.tar.gz dist/*.zip dist/*.deb dist/*.rpm dist/checksums.txt 2>/dev/null || ls -1 dist/ if [[ -n "${GITHUB_ENV:-}" ]]; then echo "VGW_DIST_DIR=${SRC}/dist" >> "${GITHUB_ENV}" fi