Something went wrong. Try again.
An auto tiler for macOS
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423#!/bin/bashset +xset +vset -euo pipefailcd "$(dirname "$0")/.."# shellcheck source=Scripts/product.envsource Scripts/product.envsource Scripts/version.sh
work=''terminal_state=''summary_enabled=falseskipped_steps=()skip_count=0required_steps=('Publish the release tag' 'Complete matching release CI' 'Download signed release evidence' 'Publish the verified appcast')required_done=(false false false false)cleanup() { local status=$? index incomplete=false trap - EXIT if [[ -n $terminal_state ]] && ! /bin/stty "$terminal_state" <&0; then printf 'Launch: Could not restore terminal settings.\n' >&2 status=1 fi if [[ -n $work ]] && ! rm -rf "$work"; then status=1; fi if [[ $summary_enabled == true ]]; then printf '\nLaunch summary for %s\n' "$tag" >&2 for (( index=0; index<${#required_steps[@]}; index++ )); do if [[ ${required_done[index]} == true ]]; then printf ' Completed: %s\n' "${required_steps[index]}" >&2 else printf ' Incomplete (required): %s\n' "${required_steps[index]}" >&2 incomplete=true fi done for (( index=0; index<skip_count; index++ )); do printf ' Skipped: %s\n' "${skipped_steps[index]}" >&2 done if (( status == 0 )) && [[ $incomplete == true ]]; then status=3; fi fi if (( status == 3 )); then printf 'Launch incomplete (exit 3). Required steps remain; rerun with the same version to resume.\n' >&2 elif (( status != 0 )); then printf 'Launch stopped. Completed remote steps remain; run the same command to resume.\n' >&2 elif [[ $summary_enabled == true ]]; then printf 'Launch complete. Review/build/deploy the site yourself; no site commit or push was made.\n' >&2 fi exit "$status"}trap cleanup EXITtrap 'exit 130' INTtrap 'exit 143' TERMfail() { printf 'Launch: %s\n' "$*" >&2; exit 1; }say() { printf '%s\n' "$*"; }usage() { say 'Usage: Scripts/launch.sh [--dry-run] [--version VERSION] [--site-repo PATH] [--site-feed RELATIVE_PATH] [--replace-secret NAME]'; }# Fixture runs need fewer rounds, not a longer timeout; normal launches still wait sixty times.poll_attempts=${PARCEL_LAUNCH_POLL_ATTEMPTS-60}if [[ ! $poll_attempts =~ ^[1-9][0-9]?$ ]] || (( poll_attempts > 60 )); then fail 'Polling attempts must be an integer from 1 to 60.'fireadonly poll_attemptsrequired_secrets=(DEVELOPER_ID_P12 DEVELOPER_ID_PASSWORD DEVELOPER_ID_IDENTITY APPLE_TEAM_ID ASC_PRIVATE_KEY ASC_KEY_ID ASC_ISSUER_ID SPARKLE_PRIVATE_KEY)prohibited_secrets=("${required_secrets[@]}" APPLE_ID APPLE_APP_PASSWORD SPARKLE_PUBLIC_KEY MIRROR_TOKEN)replace_secret=''dry_run=falseversion=$PRODUCT_FIRST_VERSIONsite=$PRODUCT_SITE_REPOfeed=$PRODUCT_SITE_FEEDwhile (( $# )); do case $1 in --dry-run) dry_run=true; shift ;; --version|--site-repo|--site-feed|--replace-secret) (( $# >= 2 )) || { usage >&2; exit 2; } case $1 in --version) version=$2 ;; --site-repo) site=$2 ;; --site-feed) feed=$2 ;; --replace-secret) replace_secret=$2 ;; esac shift 2 ;; --help) usage; exit 0 ;; *) usage >&2; exit 2 ;; esacdonevalidate_ordered_version "$version" || fail 'Choose a MAJOR.MINOR.PATCH release version.'[[ -n $site && -n $feed && $feed != /* && /$feed/ != */../* ]] || fail 'Choose a site repo and a feed path inside it.'if [[ -n $replace_secret ]]; then valid=false for name in "${required_secrets[@]}" MIRROR_TOKEN; do if [[ $replace_secret == "$name" && $name != SPARKLE_PRIVATE_KEY ]]; then valid=true; fi done [[ $valid == true ]] || fail 'Choose a supported secret. The permanent Sparkle key cannot be replaced here.'fitag=v$versionservice="$PRODUCT_BUNDLE_ID.launch"repo=$PRODUCT_GITHUB_REPOskip_step() { skipped_steps[skip_count]=$* skip_count=$((skip_count + 1))}confirm() { local answer printf '%s [y/N] ' "$*" >&2 IFS= read -r answer || fail 'Input closed. Run again to resume.' [[ $answer == y || $answer == Y ]] && return 0 skip_step "$*" say 'Skipped.' >&2 return 1}explain_secret() { case $1 in DEVELOPER_ID_P12) say 'Export only your Developer ID Application certificate AND private key from Keychain Access as a password-protected .p12.' ;; DEVELOPER_ID_PASSWORD) say 'Use the password you chose when exporting that .p12.' ;; DEVELOPER_ID_IDENTITY) say 'Use the exact Developer ID Application identity from security find-identity -v -p codesigning.' ;; APPLE_TEAM_ID) say 'Find the Team ID at developer.apple.com/account under Membership details.' ;; ASC_PRIVATE_KEY) say 'Use the downloaded App Store Connect API private key (.p8). It replaces Apple Account passwords for notarization.' ;; ASC_KEY_ID) say 'Use the App Store Connect API Key ID.' ;; ASC_ISSUER_ID) say 'Use the App Store Connect API Issuer ID.' ;; MIRROR_TOKEN) say "Create a fine-grained GitHub PAT for $repo only: Contents and Workflows read/write. Store it only in GitHub environment mirror, restricted to $PRODUCT_DEFAULT_BRANCH. Set an expiry and renew it before then; never put it in tangled pipelines or repository secrets." ;; esac}tunnel_commands() { printf 'cloudflared tunnel login\n' printf 'cloudflared tunnel create %q\n' "$PRODUCT_TUNNEL" printf 'cloudflared tunnel route dns %q %q\n' "$PRODUCT_TUNNEL" "${PRODUCT_SITE_URL#https://}" printf 'cloudflared tunnel run --url %q %q\n' "http://localhost:$PRODUCT_SITE_PORT" "$PRODUCT_TUNNEL"}if [[ $dry_run == true ]]; then say "Dry run: $PRODUCT_NAME ($PRODUCT_CLI, $PRODUCT_BUNDLE_ID), $tag. No commands, secrets, files, or remotes changed." say "1. Check signing tools, gh authentication and SSH access to $PRODUCT_KNOT_URL (read-only, confirmed); compile a fresh Keychain helper into a private mktemp directory for each launch." say "2. Follow docs/releasing-setup.md: public mirror $repo, release owner review, release and mirror environments restricted to $PRODUCT_DEFAULT_BRANCH, protected default branch and immutable release tags. Policy checks are read-only; no repository, remote, or policy settings are changed here." for name in "${required_secrets[@]}"; do say "3. $name: optionally reuse Keychain or prompt without echo; explicitly confirm before uploading to GitHub environment release." explain_secret "$name" done say '4. Commit the permanent SPARKLE_PUBLIC_KEY as PRODUCT_UPDATE_PUBLIC_KEY in Scripts/product.env; never rotate it implicitly.' explain_secret MIRROR_TOKEN say '5. Optionally prepare MIRROR_TOKEN in Keychain; explicitly confirm its upload to GitHub environment mirror, never release or tangled.' say "6. Repository-level signing secrets or MIRROR_TOKEN BLOCK release tag push and manual release dispatch. Migrate/remove copies using docs/releasing-setup.md; this script never deletes secrets. Replacement requested: ${replace_secret:-none}." say "7. GitHub mirror runs from $PRODUCT_DEFAULT_BRANCH every 15 minutes or by manual dispatch (not pushes), mirrors only $PRODUCT_DEFAULT_BRANCH and eligible v tags; no secret-bearing tangled workflows. Push only explicitly confirmed branches/tags directly to $PRODUCT_KNOT_URL; no local remotes are added or replaced." say '8. Before a tag push, verify required environment secrets, owner review, main-only environment policies, default branch/tag protections, repository secret scope and GitHub commit ancestry.' say "9. Wait for $PRODUCT_RELEASE_WORKFLOW, event workflow_dispatch on $PRODUCT_DEFAULT_BRANCH, displayTitle 'Release $tag'. New GitHub tag pushes, including mirrored tags, trigger the default-branch dispatcher; offer confirmed manual dispatch with tag=$tag only if no matching run appears. Older tags without the dispatcher need manual dispatch." say "10. Download $PRODUCT_RELEASE_ARTIFACT and release DMG/checksums into separate new directories; verify signatures and release ordering before merging $site/$feed." say '11. The final summary lists every skipped step. Exit 3 means required tag/CI/download/feed steps remain incomplete; no success is claimed.' say '12. Review/build/deploy the site yourself. No site commits, pushes, or DNS changes are automatic.' tunnel_commands exit 0fi[[ -t 0 ]] || fail 'Run interactively, or use --dry-run.'summary_enabled=true[[ $(uname -s) == Darwin ]] || fail 'Run this on the signing Mac.'for tool in swiftc security xcrun gh git ssh cloudflared; do command -v "$tool" >/dev/null || fail "Install $tool first."donexcrun --find notarytool >/dev/nullidentities=$(security find-identity -v -p codesigning)[[ $identities == *'Developer ID Application:'* ]] || fail 'Install a Developer ID Application certificate with its private key in Keychain Access first.'say "$identities"[[ -z $(git status --porcelain --untracked-files=normal) ]] || fail 'The release checkout must be clean.'branch=$(git symbolic-ref --quiet --short HEAD) || fail 'Check out the branch you want to publish.'commit=$(git rev-parse HEAD)umask 077work=$(mktemp -d "${TMPDIR:-/tmp}/launch.XXXXXX")keychain="$work/keychain"swiftc -swift-version 6 -warnings-as-errors Scripts/launch-keychain.swift -o "$keychain"if confirm "Check GitHub login and SSH access to $PRODUCT_KNOT_HOST?"; then gh auth status GIT_SSH_COMMAND='ssh -o BatchMode=yes -o StrictHostKeyChecking=yes' git ls-remote "$PRODUCT_KNOT_URL" >/dev/nullfiif confirm "Inspect the GitHub mirror $repo (read-only)?"; then gh repo view "$repo" --json nameWithOwner,url || fail 'The mirror could not be read. Check access and docs/releasing-setup.md; no repository was created.'fiowner_id=''read_owner() { owner_id=$(gh api "users/${repo%%/*}" --jq '.id') [[ $owner_id =~ ^[1-9][0-9]*$ ]] || fail 'The release reviewer must be a user repository owner.'}read_environment() { local environment=$1 gh api "repos/$repo/environments/$environment" > "$work/$environment-environment.json" gh api "repos/$repo/environments/$environment/deployment-branch-policies" --paginate --slurp \ --jq '{branch_policies: [.[].branch_policies[]]}' > "$work/$environment-policies.json" if [[ $environment == release ]]; then Scripts/parcel-dev.sh policy-environment "$work/$environment-environment.json" "$work/$environment-policies.json" "$owner_id" "$PRODUCT_DEFAULT_BRANCH" else Scripts/parcel-dev.sh policy-mirror-environment "$work/$environment-environment.json" "$work/$environment-policies.json" "$PRODUCT_DEFAULT_BRANCH" fi}read_rules() { local ruleset_id protected=false gh api "repos/$repo/rulesets" --paginate --slurp --jq '[.[][]]' > "$work/rulesets.json" ruleset_id=$(Scripts/parcel-dev.sh policy-release-tag-ids "$work/rulesets.json") [[ $ruleset_id =~ ^[1-9][0-9]*$ ]] || fail 'Configure exactly one release-tags ruleset using docs/releasing-setup.md before publishing.' gh api "repos/$repo/rulesets/$ruleset_id" > "$work/tag-ruleset.json" Scripts/parcel-dev.sh policy-ruleset "$work/tag-ruleset.json" Scripts/parcel-dev.sh policy-branch-rule-ids "$work/rulesets.json" > "$work/branch-rule-ids" while IFS= read -r ruleset_id; do [[ -n $ruleset_id ]] || continue [[ $ruleset_id =~ ^[1-9][0-9]*$ ]] || fail 'Invalid default branch ruleset ID.' gh api "repos/$repo/rulesets/$ruleset_id" > "$work/branch-ruleset.json" if Scripts/parcel-dev.sh policy-branch-ruleset "$work/branch-ruleset.json" "$PRODUCT_DEFAULT_BRANCH" 2> "$work/branch-rule-error"; then protected=true else printf 'Ruleset %s is not sufficient default branch protection: %s\n' "$ruleset_id" "$(< "$work/branch-rule-error")" >&2 fi done < "$work/branch-rule-ids" if [[ $protected != true ]]; then say 'No sufficient default branch ruleset found; checking classic branch protection (read-only).' >&2 gh api "repos/$repo/branches/$PRODUCT_DEFAULT_BRANCH/protection" > "$work/branch-protection.json" || fail 'Could not read default branch protection. Follow docs/releasing-setup.md; no settings were changed.' Scripts/parcel-dev.sh policy-branch-protection "$work/branch-protection.json" fi}read_repository_secrets() { gh secret list --repo "$repo" --json name > "$work/repository-secrets.json" Scripts/parcel-dev.sh policy-repository-secrets "$work/repository-secrets.json" "${prohibited_secrets[@]}"}verify_policies() { [[ $(gh api "repos/$repo" --jq '.default_branch') == "$PRODUCT_DEFAULT_BRANCH" ]] || fail "The GitHub default branch must be $PRODUCT_DEFAULT_BRANCH; review docs/releasing-setup.md." read_repository_secrets read_owner read_environment release read_environment mirror read_rules gh secret list --repo "$repo" --env release --json name > "$work/secrets.json" Scripts/parcel-dev.sh policy-secrets "$work/secrets.json" "${required_secrets[@]}" gh secret list --repo "$repo" --env mirror --json name > "$work/mirror-secrets.json" Scripts/parcel-dev.sh policy-secrets "$work/mirror-secrets.json" MIRROR_TOKEN}verify_commit() { [[ -n $PRODUCT_UPDATE_PUBLIC_KEY ]] || fail 'Commit PRODUCT_UPDATE_PUBLIC_KEY before publishing a release.' [[ $(gh api "repos/$repo/commits/$commit" --jq '.sha') == "$commit" ]] || fail 'The release commit is not available on GitHub yet.' git fetch --no-tags "https://github.com/$repo.git" "refs/heads/$PRODUCT_DEFAULT_BRANCH:refs/remotes/github/$PRODUCT_DEFAULT_BRANCH" 'refs/tags/v*:refs/tags/v*' git merge-base --is-ancestor "$commit" "refs/remotes/github/$PRODUCT_DEFAULT_BRANCH" || fail "The release commit must be an ancestor of GitHub $PRODUCT_DEFAULT_BRANCH."}verify_github_tag() { [[ $(gh api "repos/$repo/commits/$tag" --jq '.sha') == "$commit" ]] || fail 'The GitHub release tag must match this checkout commit. Check mirroring; no release was dispatched.'}say 'Remote setup is owner-managed. Follow docs/releasing-setup.md; this script only reads policy settings.'if confirm 'Inspect release/mirror environments, branch/tag protections and secret scope (read-only)?'; then verify_policies; fisecret_value=''load_secret() { local name=$1 status path repeated operation=put if [[ $name != "$replace_secret" ]]; then if secret_value=$("$keychain" get "$service" "$name"); then return; else status=$? [[ $status == 44 ]] || fail "Could not read $name from Keychain." fi else confirm "Replace $name in local Keychain?" || fail 'Replacement cancelled; no secret changed.' operation=replace fi explain_secret "$name" >&2 if [[ $name == DEVELOPER_ID_P12 || $name == ASC_PRIVATE_KEY ]]; then printf 'Path to the exported credential file: ' >&2 IFS= read -r path || fail 'No credential path supplied.' [[ -f $path && ! -L $path ]] || fail 'Credential file not found or is a symlink.' if [[ $name == DEVELOPER_ID_P12 ]]; then secret_value=$(/usr/bin/base64 -i "$path" | tr -d '\n') else secret_value=$(< "$path") fi else terminal_state=$(/bin/stty -g <&0) || fail 'Could not read terminal settings.' /bin/stty -echo <&0 || fail 'Could not disable terminal echo.' printf '%s (hidden): ' "$name" >&2 IFS= read -r secret_value || fail "No value supplied for $name." printf '\nRepeat %s (hidden): ' "$name" >&2 IFS= read -r repeated || fail "No confirmation supplied for $name." /bin/stty "$terminal_state" <&0 || fail 'Could not restore terminal settings.' terminal_state='' printf '\n' >&2 [[ $secret_value == "$repeated" ]] || fail 'Values do not match; nothing was stored.' fi [[ -n $secret_value && ${#secret_value} -lt 48000 ]] || fail 'Secret is empty or exceeds the GitHub secret size limit.' printf '%s' "$secret_value" | "$keychain" "$operation" "$service" "$name" if [[ $name == DEVELOPER_ID_P12 ]] && confirm 'Delete the exported .p12 now that it is saved in Keychain? Keep a secure backup.'; then rm "$path" fi}for name in "${required_secrets[@]}"; do [[ $name != SPARKLE_PRIVATE_KEY ]] || continue explain_secret "$name" if confirm "Prepare $name in local Keychain?"; then load_secret "$name" if confirm "Set $name in GitHub environment release for $repo (replaces its current value)?"; then read_owner read_environment release printf '%s' "$secret_value" | gh secret set "$name" --repo "$repo" --env release fi secret_value='' else skip_step "Set $name in GitHub environment release (local preparation skipped)." fidonesay 'Sparkle uses a permanent key. Back it up securely; changing it breaks existing clients.'if confirm "Create or reuse the Sparkle key for $PRODUCT_BUNDLE_ID in Keychain?"; then public_key=$("$keychain" ensure-update "$PRODUCT_BUNDLE_ID") say "Public update key: $public_key" [[ -n $PRODUCT_UPDATE_PUBLIC_KEY ]] || fail 'Commit this public key as PRODUCT_UPDATE_PUBLIC_KEY in Scripts/product.env, then resume. No tag was pushed.' [[ $public_key == "$PRODUCT_UPDATE_PUBLIC_KEY" ]] || fail 'The local update key differs from the committed public key; refusing rotation.' if confirm "Set SPARKLE_PRIVATE_KEY in GitHub environment release for $repo?"; then read_owner read_environment release "$keychain" get https://sparkle-project.org "$PRODUCT_BUNDLE_ID" | gh secret set SPARKLE_PRIVATE_KEY --repo "$repo" --env release fielse skip_step 'Set SPARKLE_PRIVATE_KEY in GitHub environment release (local key preparation skipped).'fiif confirm 'Inspect repository-level secret blockers (read-only; migrate using docs/releasing-setup.md)?'; then read_repository_secrets; fiexplain_secret MIRROR_TOKENif confirm 'Prepare MIRROR_TOKEN in local Keychain?'; then load_secret MIRROR_TOKEN if confirm "Set MIRROR_TOKEN in GitHub environment mirror for $repo (replaces its current value)?"; then read_environment mirror printf '%s' "$secret_value" | gh secret set MIRROR_TOKEN --repo "$repo" --env mirror fi secret_value=''else skip_step 'Set MIRROR_TOKEN in GitHub environment mirror (local preparation skipped).'fiif confirm "Push $branch ($commit) to $PRODUCT_KNOT_URL? GitHub mirrors only $PRODUCT_DEFAULT_BRANCH and eligible v tags every 15 minutes or by manual dispatch, never on pushes."; then git push "$PRODUCT_KNOT_URL" "HEAD:refs/heads/$branch"fiif confirm "Create release tag $tag at $commit if missing?"; then if git show-ref --verify --quiet "refs/tags/$tag"; then [[ $(git rev-parse "$tag^{commit}") == "$commit" ]] || fail 'Existing tag points to another commit; never moving it.' say 'Local release tag already matches.' else git tag -a "$tag" -m "Release $version" "$commit"; fifiif confirm "Push $tag to tangled? First verify environment secrets, main-only policies, branch/tag protections, repository secret scope and main ancestry."; then [[ $(git rev-parse "$tag^{commit}") == "$commit" ]] || fail 'Create the tag at this commit first.' verify_policies verify_commit git push "$PRODUCT_KNOT_URL" "refs/tags/$tag:refs/tags/$tag" required_done[0]=truefirun_id=''find_release_run() { gh run list --repo "$repo" --workflow "$PRODUCT_RELEASE_WORKFLOW" --event workflow_dispatch --branch "$PRODUCT_DEFAULT_BRANCH" \ --limit 100 --json databaseId,headSha,headBranch,displayTitle,event > "$work/runs.json" run_id=$(Scripts/parcel-dev.sh policy-release-run "$work/runs.json" "$PRODUCT_DEFAULT_BRANCH" "Release $tag")}wait_for_run() { local attempt for (( attempt=0; attempt<poll_attempts; attempt++ )); do find_release_run [[ -z $run_id ]] || return 0 sleep 15 done}if confirm "Wait for GitHub release CI for $tag (workflow_dispatch on $PRODUCT_DEFAULT_BRANCH, title Release $tag; up to 15 minutes to appear)?"; then verify_github_tag wait_for_run if [[ -z $run_id ]]; then say 'No matching release run appeared. New mirror tags dispatch automatically; manual dispatch can resume an existing tag.' if confirm "Dispatch $PRODUCT_RELEASE_WORKFLOW on $PRODUCT_DEFAULT_BRANCH with tag=$tag to resume? Confirm no matching run is pending to avoid a duplicate."; then verify_policies verify_commit verify_github_tag find_release_run if [[ -z $run_id ]]; then gh workflow run "$PRODUCT_RELEASE_WORKFLOW" --repo "$repo" --ref "$PRODUCT_DEFAULT_BRANCH" -f "tag=$tag" wait_for_run else say "Matching release run $run_id appeared; no duplicate was dispatched." fi else fail 'Release CI did not appear. Check mirroring and Actions, then resume.' fi fi [[ $run_id =~ ^[1-9][0-9]*$ ]] || fail 'Release CI did not appear after dispatch. Check Actions, then resume.' conclusion=$(gh run view "$run_id" --repo "$repo" --json conclusion --jq '.conclusion') case $conclusion in failure|cancelled|timed_out|action_required|startup_failure|stale) if confirm "Rerun failed jobs in release run $run_id? Draft releases can resume; published releases cannot be replaced."; then verify_policies old_attempt=$(gh run view "$run_id" --repo "$repo" --json attempt --jq '.attempt') [[ $old_attempt =~ ^[1-9][0-9]*$ ]] || fail 'Could not read the previous run attempt.' gh run rerun "$run_id" --repo "$repo" --failed for (( attempt=0; attempt<poll_attempts; attempt++ )); do new_attempt=$(gh run view "$run_id" --repo "$repo" --json attempt --jq '.attempt') [[ $new_attempt =~ ^[1-9][0-9]*$ ]] || fail 'Could not read the new run attempt.' (( new_attempt > old_attempt )) && break sleep 5 done (( new_attempt > old_attempt )) || fail 'The new attempt did not start; resume later.' else fail 'Release CI has not succeeded. Resume after fixing it.'; fi ;; success|''|null) ;; *) fail "Unexpected release CI conclusion: $conclusion" ;; esac gh run watch "$run_id" --repo "$repo" --exit-status [[ $(gh run view "$run_id" --repo "$repo" --json conclusion --jq '.conclusion') == success ]] || fail 'Release CI has not succeeded. Resume after fixing it.' required_done[1]=truefiif [[ -n $run_id ]]; then if confirm "Download the signed appcast artifact from successful run $run_id?"; then mkdir "$work/artifact" "$work/downloads" gh run download "$run_id" --repo "$repo" --name "$PRODUCT_RELEASE_ARTIFACT" --dir "$work/artifact" gh release download "$tag" --repo "$repo" --pattern "$PRODUCT_NAME-$version.dmg" --pattern SHA256SUMS --dir "$work/downloads" [[ -f $work/artifact/appcast.xml ]] || fail 'CI artifact has no appcast.xml.' [[ -f $work/downloads/$PRODUCT_NAME-$version.dmg && -f $work/downloads/SHA256SUMS ]] || fail 'Release download lacks its DMG or SHA256SUMS.' required_done[2]=true if confirm "Publish the appcast into $site/$feed? This may become public immediately."; then [[ -d $site ]] || fail 'Create the site checkout first, then resume.' site_root=$(git -C "$site" rev-parse --show-toplevel) [[ $site_root == "$(cd "$site" && pwd -P)" ]] || fail 'The site path must be its own repository root.' verify_commit Scripts/parcel-dev.sh launch-feed "$work/artifact/appcast.xml" "$site" "$feed" "$version" \ "https://github.com/$repo/releases/download/$tag/$PRODUCT_NAME-$version.dmg" \ "$work/downloads/$PRODUCT_NAME-$version.dmg" "$work/downloads/SHA256SUMS" "$PRODUCT_UPDATE_PUBLIC_KEY" "$PWD" required_done[3]=true say 'Review/build/deploy the site diff yourself. No site commit or push was made.' fi else skip_step 'Publish the verified appcast (signed evidence download skipped).' fielse skip_step 'Download signed release evidence (release CI wait skipped).' skip_step 'Publish the verified appcast (release CI wait skipped).'fisay "Serve your built site on localhost:$PRODUCT_SITE_PORT, with /appcast.xml available."say 'Review the tunnel commands before login or DNS changes; reuse an existing tunnel.'tunnel_commands