Something went wrong. Try again.
An auto tiler for macOS
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768#!/bin/bashset +xset +vset -euo pipefailcd "$(dirname "$0")/.."# shellcheck source=Scripts/product.envsource Scripts/product.envsource Scripts/version.shsource Scripts/packaging-paths.shvalue() { local name="${PRODUCT_ENV_PREFIX}_$1"; printf '%s' "${!name:-}"; }fail() { printf '%s\n' "$*" >&2; exit 1; }[[ ${GITHUB_ACTIONS:-} == true && ${RUNNER_ENVIRONMENT:-} == github-hosted ]] || fail 'CI signing requires a GitHub-hosted runner.'[[ $(git rev-parse HEAD) == "$(git rev-parse "origin/$PRODUCT_DEFAULT_BRANCH")" ]] || fail 'Signing scripts must come from the default branch.'seed=$(/bin/cat)[[ -n $seed ]] || fail 'Provide the update seed on stdin.'app=$(value SIGNING_APP)identity=$(value SIGN_IDENTITY)version_name="${PRODUCT_ENV_PREFIX}_VERSION"build_name="${PRODUCT_ENV_PREFIX}_BUILD_NUMBER"version=${!version_name-}build=${!build_name-}validate_release_version "$version" "$build"output=$(value RELEASE_DIR)public=$(value UPDATE_PUBLIC_KEY)[[ -n $identity && $identity != - && -n $output && -n $public && $public == "$PRODUCT_UPDATE_PUBLIC_KEY" ]] || fail 'Invalid signing inputs.'app=$(packaging_app_path "$app")output=$(packaging_output_path "$output")Scripts/bundle-preflight.sh "$app"mkdir -p "$(dirname "$output")"work=$(mktemp -d "$(dirname "$output")/.sign-release.XXXXXX")work=$(cd "$work" && pwd)trap 'rm -rf "$work"' EXITframework="$app/Contents/Frameworks/Sparkle.framework"Scripts/parcel-dev.sh release-bundle-identity "$app/Contents/Info.plist" "$PRODUCT_BUNDLE_ID" "$version" "$build"Scripts/parcel-dev.sh update-metadata configure "$app/Contents/Info.plist" release# The credential umask must not make the installed app unreadable to other users.Scripts/parcel-dev.sh release-bundle-permissions "$app"printf '%s\n' '<?xml version="1.0"?><plist version="1.0"><dict/></plist>' > "$work/empty.entitlements"sign() { local args=(--force --sign "$identity" --options runtime --timestamp) [[ ${1:-} == --entitlements ]] || args+=(--entitlements "$work/empty.entitlements") if ! codesign "${args[@]}" "$@" > "$work/sign.log" 2>&1; then /bin/cat "$work/sign.log" >&2 fail 'Could not sign the release.' fi}# Keep the downloader sandboxed without trusting entitlements from the archive.printf '%s\n' '<?xml version="1.0"?><plist version="1.0"><dict><key>com.apple.security.app-sandbox</key><true/><key>com.apple.security.network.client</key><true/></dict></plist>' > "$work/downloader.entitlements"sign "$framework/Versions/B/XPCServices/Installer.xpc"sign --entitlements "$work/downloader.entitlements" "$framework/Versions/B/XPCServices/Downloader.xpc"sign "$framework/Versions/B/Autoupdate"sign "$framework/Versions/B/Updater.app"sign "$framework"sign "$app/Contents/Resources/bin/$PRODUCT_CLI"sign "$app"Scripts/check-bundle.sh --no-launch "$app"mkdir "$work/artifacts"artifact="$work/artifacts/$PRODUCT_NAME-$version.dmg"export "${PRODUCT_ENV_PREFIX}_DMG_PATH=$artifact"Scripts/notarize.shsignature=$(printf '%s' "$seed" | Scripts/parcel-dev.sh update-crypto sign "$artifact")unset seedScripts/parcel-dev.sh update-crypto verify "$artifact" "$signature" "$public"Scripts/parcel-dev.sh update-metadata release "$artifact" "$signature" "$work/artifacts" "Packaging/$PRODUCT_CASK.rb"mv -n "$work/artifacts" "$output"[[ ! -d $work/artifacts ]] || fail "Refusing to replace: $output"printf 'Signed release artifacts: %s\n' "$output"