Repository Public
1#!/bin/zsh2# Archives, exports and uploads the iOS app to App Store Connect (TestFlight) with the existing API key.3# Usage: Scripts/release-ios.sh archive|export|upload|all (all = archive + export)4set -euo pipefail5cd "$(dirname "$0")/.."6KEY_ID="${ASC_KEY_ID:-L379BDKR69}"7ISSUER="${ASC_ISSUER_ID:-013e761f-e05c-4d93-a50b-f3d960adae4a}"8KEY="$HOME/.appstoreconnect/private_keys/AuthKey_${KEY_ID}.p8"9AUTH=(-allowProvisioningUpdates -authenticationKeyPath "$KEY" -authenticationKeyID "$KEY_ID" -authenticationKeyIssuerID "$ISSUER")10ARCHIVE="build/SPMessage-iOS.xcarchive"11mkdir -p build/logs dist12step="${1:-all}"13if [[ "$step" == archive || "$step" == all ]]; then14 Scripts/build-core.sh && xcodegen generate --quiet15 rm -rf "$ARCHIVE"16 xcodebuild -project SPMessage.xcodeproj -scheme SPMessage-iOS -configuration Release -destination "generic/platform=iOS" \17 -archivePath "$ARCHIVE" -derivedDataPath build/DerivedData-ios-release "${AUTH[@]}" archive > build/logs/ios-archive.log 2>&1 \18 || { grep -E "error:|\*\* " build/logs/ios-archive.log | sort -u | head -20; exit 1; }19 APP="$ARCHIVE/Products/Applications/SP Message.app"20 echo "archive : $(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$APP/Info.plist") ($(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$APP/Info.plist"))"21fi22if [[ "$step" == export || "$step" == all ]]; then23 rm -rf dist/ios-export24 xcodebuild -exportArchive -archivePath "$ARCHIVE" -exportOptionsPlist Scripts/ExportOptions.plist -exportPath dist/ios-export "${AUTH[@]}" > build/logs/ios-export.log 2>&1 \25 || { grep -E "error:|\*\* " build/logs/ios-export.log | sort -u | head -20; exit 1; }26 ls -lh dist/ios-export/*.ipa27fi28if [[ "$step" == upload ]]; then29 xcrun altool --upload-app -f "dist/ios-export/SP Message.ipa" -t ios --apiKey "$KEY_ID" --apiIssuer "$ISSUER" 2>&1 | tee build/logs/ios-upload.log | tail -1230fi31