hex/.github/release/lib.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

25 lines
885 B
Shell
Executable file

# shellcheck shell=bash
# Shared helpers for the release scripts. Sourced, never executed.
#
# .github/release/ and .github/workflows/release-desktop.yml are the security
# boundary for releases (docs/releasing.md). Jobs that hold a secret or an
# OIDC token check out only this directory and run only these scripts, on
# verified artifacts that they treat as data: they never build, install
# dependencies, or execute repository code or artifact contents. Every value
# that names a destination comes from the environment the workflow sets.
set -euo pipefail
die() {
echo "::error::$*" >&2
exit 1
}
sha256() {
if command -v sha256sum > /dev/null; then sha256sum "$@"; else shasum -a 256 "$@"; fi
}
# Windows runners pass D:\a\_temp style paths; Git Bash tools want /d/a/_temp.
posix() {
if command -v cygpath > /dev/null; then cygpath -u "$1"; else printf '%s' "$1"; fi
}