diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4fbeb92..7d768fc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,13 +30,29 @@ jobs: BUNDLE_ID: dev.ericdahl.ControllerBridge PROFILE_NAME: ControllerBridge CI Mac App Store PROFILE_TYPE: MAC_APP_STORE - HAS_SECRETS: ${{ secrets.ASC_KEY_P8 != '' && secrets.DIST_CERT_P12_BASE64 != '' && secrets.MAC_INSTALLER_CERT_P12_BASE64 != '' }} steps: + # All eight, by name only (never a value), so a missing one stops here instead of failing later in signing. - name: Check the secrets - if: env.HAS_SECRETS != 'true' + env: + HAS_ASC_KEY_ID: ${{ secrets.ASC_KEY_ID != '' }} + HAS_ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID != '' }} + HAS_ASC_KEY_P8: ${{ secrets.ASC_KEY_P8 != '' }} + HAS_DEVELOPMENT_TEAM: ${{ secrets.DEVELOPMENT_TEAM != '' }} + HAS_DIST_CERT_P12_BASE64: ${{ secrets.DIST_CERT_P12_BASE64 != '' }} + HAS_DIST_CERT_PASSWORD: ${{ secrets.DIST_CERT_PASSWORD != '' }} + HAS_MAC_INSTALLER_CERT_P12_BASE64: ${{ secrets.MAC_INSTALLER_CERT_P12_BASE64 != '' }} + HAS_MAC_INSTALLER_CERT_PASSWORD: ${{ secrets.MAC_INSTALLER_CERT_PASSWORD != '' }} run: | - echo "::error::Missing release secrets: ASC_KEY_P8, DIST_CERT_P12_BASE64 and MAC_INSTALLER_CERT_P12_BASE64 (and their passwords) must be set (see docs/DEVELOPING.md)." - exit 1 + missing="" + for name in ASC_KEY_ID ASC_ISSUER_ID ASC_KEY_P8 DEVELOPMENT_TEAM DIST_CERT_P12_BASE64 DIST_CERT_PASSWORD \ + MAC_INSTALLER_CERT_P12_BASE64 MAC_INSTALLER_CERT_PASSWORD; do + flag="HAS_$name" + [ "${!flag}" = true ] || missing="$missing $name" + done + if [ -n "$missing" ]; then + echo "::error::Missing release secrets:$missing. Add them, or give this repository access to the org secrets (see docs/DEVELOPING.md)." + exit 1 + fi - uses: actions/checkout@v4 with: diff --git a/scripts/preflight.sh b/scripts/preflight.sh index c8f4094..3be8ae0 100755 --- a/scripts/preflight.sh +++ b/scripts/preflight.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Checks what App Store Connect refuses a Mac build for, before any upload: version and build numbers, the export +# Checks what App Store Connect refuses a Mac build for, before any upload: the bundle id and display name, version and build numbers, the export # compliance and category keys, no Dock icon, the privacy manifest, the app icon, and the sandbox entitlements. # Ported from ShowRecorder's preflight, Mac only. # scripts/preflight.sh path/to/ControllerBridge.xcarchive (or path/to/ControllerBridge.app) @@ -22,6 +22,15 @@ plist="$app/Contents/Info.plist" resources="$app/Contents/Resources" read_key() { /usr/libexec/PlistBuddy -c "Print :$1" "$plist" 2>/dev/null || true; } +# The App Store Connect record is for this bundle id; the release workflow passes the same one as BUNDLE_ID. +expected_id="${BUNDLE_ID:-dev.ericdahl.ControllerBridge}" +bundle_id=$(read_key CFBundleIdentifier) +[ "$bundle_id" = "$expected_id" ] && ok "bundle id $bundle_id" || bad "CFBundleIdentifier is '$bundle_id', not $expected_id" + +# The name people see (DeckBridge, #29); the product and the .app stay ControllerBridge. +display_name=$(read_key CFBundleDisplayName) +case "$display_name" in ''|*'$('*) bad "CFBundleDisplayName is '$display_name'" ;; *) ok "display name $display_name" ;; esac + version=$(read_key CFBundleShortVersionString) build=$(read_key CFBundleVersion) case "$version" in ''|*'$('*) bad "CFBundleShortVersionString is '$version'" ;; *) ok "version $version" ;; esac diff --git a/scripts/test-preflight.sh b/scripts/test-preflight.sh index 0801779..5035c31 100755 --- a/scripts/test-preflight.sh +++ b/scripts/test-preflight.sh @@ -23,6 +23,7 @@ make_app() { -c "Add :ITSAppUsesNonExemptEncryption bool false" \ -c "Add :LSApplicationCategoryType string public.app-category.music" \ -c "Add :LSUIElement bool true" \ + -c "Add :CFBundleDisplayName string DeckBridge" \ -c "Add :CFBundleIconName string AppIcon" "$plist" >/dev/null cp App/PrivacyInfo.xcprivacy "$app/Contents/Resources/PrivacyInfo.xcprivacy" echo icon > "$app/Contents/Resources/Assets.car" @@ -63,7 +64,11 @@ app=$(make_app build); /usr/libexec/PlistBuddy -c 'Set :CFBundleVersion 12.1-dir sign "$app" "$work/build.entitlements" expect_fail "a build number that isn't numbers fails" "$app" "CFBundleVersion" -for key in ITSAppUsesNonExemptEncryption LSApplicationCategoryType LSUIElement; do +app=$(make_app bundleid); /usr/libexec/PlistBuddy -c 'Set :CFBundleIdentifier dev.ericdahl.DeckBridge' "$app/Contents/Info.plist" +sign "$app" "$work/bundleid.entitlements" +expect_fail "a bundle id App Store Connect doesn't know fails" "$app" "CFBundleIdentifier" + +for key in ITSAppUsesNonExemptEncryption LSApplicationCategoryType LSUIElement CFBundleDisplayName; do app=$(make_app "$key"); /usr/libexec/PlistBuddy -c "Delete :$key" "$app/Contents/Info.plist" sign "$app" "$work/$key.entitlements" expect_fail "a missing $key fails" "$app" "$key"