hex/.github/release/assemble.sh
Dax Raad c5338422a0 ci(release): split building from signing and publishing, like OpenCode
Build jobs (Linux, Windows x64/ARM64, macOS, Windows installers, AUR and Homebrew staging) run repository code with no environment, secret, or id-token and produce unsigned files. Sign and publish jobs run in the release environment, check out only .github/release/, and run only those scripts and SHA-pinned actions on artifacts treated as data: macOS Developer ID signing, notarization, and stapling (from APPLE_SIGNING_CERTIFICATE, APPLE_NOTARY_KEY, and the APPLE_NOTARY_KEY_ID/ISSUER_ID variables), Azure Authenticode, the release service, the GitHub release, and the AUR and Homebrew pushes. Every artifact carries a SHA256SUMS whose digest its job reports; every job that downloads it checks that digest. Signed macOS builds are verified and launched in a job without secrets. macos-signed.yml is gone (a check run covers it); the site deploy is no longer part of Release.
2026-10-27 17:02:44 -04:00

24 lines
945 B
Shell
Executable file

#!/usr/bin/env bash
# assemble.sh <in> <dist>: gathers the release files from the verified
# artifacts in <in>/<name>/ into <dist>, refusing any file that is not one of
# the release service targets for HEX_VERSION (docs/plans/release-service.md)
# or that two artifacts both hold.
. "$(dirname "$0")/lib.sh"
in=$(posix "$1")
dist=$(posix "$2")
v=$HEX_VERSION
mkdir -p "$dist"
for file in "$in"/*/*; do
name=$(basename "$file")
[ "$name" = SHA256SUMS ] && continue
case "$name" in
"hex-$v-linux-x64" | "Hex-$v-macos-arm64.zip" | "Hex-$v-macos-arm64.dmg" | \
"Hex-$v-windows-x64.exe" | "Hex-$v-windows-arm64.exe" | \
"Hex-Setup-$v-windows-x64.exe" | "Hex-Setup-$v-windows-arm64.exe") ;;
*) die "$name is not a release file of Hex $v." ;;
esac
[ ! -e "$dist/$name" ] || die "Two artifacts hold $name."
cp "$file" "$dist/$name"
done
(cd "$dist" && ls -l && sha256 -- *) | tee -a "${GITHUB_STEP_SUMMARY:-/dev/null}"