Repository Public License
1#!/bin/zsh2# ORIX Navigator — iOS/iPadOS release steps. usage: release-ios.sh archive | export | validate | upload | status3# `upload` sends a build to App Store Connect and requires ORIX_UPLOAD_AUTHORIZED=yes (the owner's go-ahead for this build).4set -euo pipefail5cd "$(dirname "$0")/.."6KEY_ID="${ASC_KEY_ID:-L379BDKR69}"7ISSUER="${ASC_ISSUER_ID:-013e761f-e05c-4d93-a50b-f3d960adae4a}"8APP_ID="6839163217"9BUNDLE_ID="ai.spboucher.orix.navigator"10ARCHIVE="build/NavigatoriOS.xcarchive"11IPA="dist/export/ORIX Navigator.ipa"12mkdir -p build/logs dist13step="${1:?usage: release-ios.sh archive | export | validate | upload | status}"1415case "$step" in16archive)17 xcodegen generate --quiet18 rm -rf "$ARCHIVE"19 xcodebuild -project ORIXNavigator.xcodeproj -scheme NavigatoriOS -configuration Release -destination "generic/platform=iOS" \20 -archivePath "$ARCHIVE" -derivedDataPath build/dd-release-ios -allowProvisioningUpdates archive > build/logs/ios-archive.log 2>&1 \21 || { grep -E "error:|\*\* " build/logs/ios-archive.log | sort -u | head -20; exit 1; }22 APP="$ARCHIVE/Products/Applications/ORIX Navigator.app"23 ID="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' "$APP/Info.plist")"24 [ "$ID" = "$BUNDLE_ID" ] || { echo "FAIL: bundle id is $ID"; exit 1; }25 echo "archive: $(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$APP/Info.plist") ($(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$APP/Info.plist")), bundle $ID, $(du -sh "$APP" | cut -f1)"26 echo "entitlements:"; codesign -d --entitlements - --xml "$APP" 2>/dev/null | plutil -p - | sed 's/^/ /'27 # No secret may ship in the bundle.28 if grep -rIlE "sk-ant-|sk-proj-|sk-or-|BEGIN (EC |RSA )?PRIVATE KEY" "$APP" 2>/dev/null | head -3 | grep -q .; then echo "FAIL: secret-looking string in the bundle"; exit 1; fi29 ;;30export)31 rm -rf dist/export32 xcodebuild -exportArchive -archivePath "$ARCHIVE" -exportOptionsPlist scripts/ExportOptions.plist -exportPath dist/export -allowProvisioningUpdates > build/logs/ios-export.log 2>&1 \33 || { grep -E "error:|\*\* " build/logs/ios-export.log | sort -u | head -20; exit 1; }34 ls -lh dist/export/*.ipa35 ;;36validate)37 xcrun altool --validate-app -f "$IPA" -t ios --apiKey "$KEY_ID" --apiIssuer "$ISSUER" 2>&1 | tee build/logs/ios-validate.log | tail -1538 ;;39upload)40 [ "${ORIX_UPLOAD_AUTHORIZED:-}" = "yes" ] || { echo "upload not authorized: set ORIX_UPLOAD_AUTHORIZED=yes for this build"; exit 3; }41 xcrun altool --upload-app -f "$IPA" -t ios --apiKey "$KEY_ID" --apiIssuer "$ISSUER" 2>&1 | tee build/logs/ios-upload.log | tail -1542 ;;43status)44 python3 scripts/testflight.py status45 ;;46*) echo "unknown step: $step"; exit 2 ;;47esac48