Files
floci/.github/scripts/release-binaries-existing.sh
T
Hector Ventura 82c82ec553 fix(release): attach missing standalone binaries to an existing release (#9696)
2.4.0 and 2.5.0 shipped no standalone binaries, and nothing could add
them afterwards: re-running a release uses the tag's own workflow and
pushes the images again. Run by hand from main with a tag, release.yml
now builds the binaries that release lacks, or the ones named, from the
tag's source, and attaches them signed and attested as a tag run does.
It first verifies the release's sha256sums.txt against its cosign
bundle and the attached binaries against that file, then rewrites it to
cover every binary. A backfill never pushes or signs images and never
creates a release; tag runs build and publish as before.

Refs #8715
2026-11-28 22:25:00 -04:00

26 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Downloads into <dir> the standalone binaries a release already carries, and its sha256sums.txt,
# for release-binaries-sums.sh to check and extend.
#
# release-binaries-existing.sh <tag> <dir>
#
# The names come from the release's asset list, and each one is downloaded by its exact name, so
# a release with nothing attached downloads nothing, while a download that fails stops the
# backfill: carrying on with a partial <dir> would rewrite sha256sums.txt without the lines of the
# binaries it missed. Of the cosign bundles only sha256sums.txt's is kept, which
# release-binaries-sums.sh verifies before trusting the file; the backfill signs what it publishes.
set -euo pipefail
TAG=${1:?usage: release-binaries-existing.sh <tag> <dir>}
DIR=${2:?usage: release-binaries-existing.sh <tag> <dir>}
mkdir -p "$DIR"
names=$(gh release view "$TAG" --json assets --jq '.assets[].name')
while IFS= read -r name; do
case "$name" in
sha256sums.txt|sha256sums.txt.sigstore.json) gh release download "$TAG" -D "$DIR" -p "$name" ;;
*.sigstore.json) continue ;;
floci-aws-*) gh release download "$TAG" -D "$DIR" -p "$name" ;;
esac
done <<< "$names"