mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-22 21:23:02 +01:00
* ci: read release secrets from aws secrets manager * ci: read the linux signing key from hex/release/RELEASE_SIGNING_KEY * ci: hex's own aur and homebrew keys; the signing cert has no password * ci: the signing certificate has no password * ci: use the shared aur and homebrew keys * docs: the shared homebrew deploy key is anomaly-release * docs: the shared homebrew deploy key is anomaly-release * site: own /hex/files, drop the r2 write credential (#1611) * site: own /hex/files for installers, appcast, and dev notes The site build now copies install-linux.sh, install-windows.ps1, and packaging/macos/legacy-appcast.xml into its Worker assets, so the same Worker serves them at /hex/files with the Content-Type and Cache-Control the bucket objects had. The Installers and Legacy appcast workflows, r2-put.sh, and their R2 write credential are gone. The dev notes move to the one-commit dev-notes branch, published by Release's dev-notes job with GITHUB_TOKEN only; the Worker proxies that file at /hex/files/dev-notes.json (falling back to the bucket copy until the first dev release creates the branch) and renders /hex/dev from it. Both site Workers now bind hex-production-files, read-only in code, for the frozen 2.3.1 feeds and artifacts, which lets hex-dev-files go. The Site build runs the installer test and appcast check the removed workflows ran, and the verify job compares the served bytes. * docs: the site owns /hex/files and needs no R2 write credential Hosting, secrets, old clients, and Linux packages describe the built installers and appcast, the dev-notes branch, and the read-only bucket.
49 lines
2.2 KiB
Shell
Executable file
49 lines
2.2 KiB
Shell
Executable file
#!/usr/bin/env bash
|
|
# macos-credentials.sh <dir>: imports the Developer ID certificate into a new
|
|
# keychain in <dir> and writes the App Store Connect API key for notarytool
|
|
# there. Prints nothing secret. Appends HEX_KEYCHAIN, HEX_SIGNING_IDENTITY,
|
|
# and HEX_NOTARY_KEY to $GITHUB_ENV.
|
|
#
|
|
# Environment: APPLE_SIGNING_CERTIFICATE (a base64 .p12 with no password),
|
|
# APPLE_NOTARY_KEY (the .p8, as PEM or base64), HEX_TEAM_ID.
|
|
. "$(dirname "$0")/lib.sh"
|
|
|
|
dir=$1
|
|
mkdir -p "$dir"
|
|
chmod 700 "$dir"
|
|
certificate="$dir/certificate.p12"
|
|
keychain="$dir/signing.keychain-db"
|
|
key="$dir/notary-key.p8"
|
|
|
|
(umask 077 && printf '%s' "$APPLE_SIGNING_CERTIFICATE" | tr -d '\r\n ' | base64 -D > "$certificate") ||
|
|
die "APPLE_SIGNING_CERTIFICATE is not base64."
|
|
[ -s "$certificate" ] || die "APPLE_SIGNING_CERTIFICATE is empty."
|
|
|
|
password=$(uuidgen)
|
|
security create-keychain -p "$password" "$keychain"
|
|
security set-keychain-settings -lut 21600 "$keychain"
|
|
security unlock-keychain -p "$password" "$keychain"
|
|
security import "$certificate" -k "$keychain" -f pkcs12 -P "" \
|
|
-T /usr/bin/codesign -T /usr/bin/security > /dev/null 2>&1 ||
|
|
die "APPLE_SIGNING_CERTIFICATE did not import; it must be a .p12 with no password."
|
|
rm -f "$certificate"
|
|
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$password" "$keychain" > /dev/null
|
|
# codesign finds identities only in the search list.
|
|
# shellcheck disable=SC2046
|
|
security list-keychains -d user -s "$keychain" $(security list-keychains -d user | tr -d '"')
|
|
identity=$(security find-identity -v -p codesigning "$keychain" |
|
|
sed -n "s/.*\"\(Developer ID Application:.*($HEX_TEAM_ID)\)\"/\1/p" | head -1)
|
|
[ -n "$identity" ] || die "APPLE_SIGNING_CERTIFICATE has no Developer ID Application identity for team $HEX_TEAM_ID."
|
|
echo "Signing as $identity."
|
|
|
|
case "$APPLE_NOTARY_KEY" in
|
|
-----BEGIN*) (umask 077 && printf '%s\n' "$APPLE_NOTARY_KEY" > "$key") ;;
|
|
*) (umask 077 && printf '%s' "$APPLE_NOTARY_KEY" | tr -d '\r\n ' | base64 -D > "$key") || die "APPLE_NOTARY_KEY is neither PEM nor base64." ;;
|
|
esac
|
|
grep -q -- '-----BEGIN PRIVATE KEY-----' "$key" || die "APPLE_NOTARY_KEY is not an App Store Connect API key (.p8)."
|
|
|
|
{
|
|
echo "HEX_KEYCHAIN=$keychain"
|
|
echo "HEX_SIGNING_IDENTITY=$identity"
|
|
echo "HEX_NOTARY_KEY=$key"
|
|
} >> "$GITHUB_ENV"
|