SPB Git

Repository Public

ios-release.sh 2.4 KB 37 lines shellscript

1#!/usr/bin/env bash2# Archives SP Browser for iOS (Release), exports an App Store Connect IPA with automatic signing through the3# App Store Connect API key ALREADY on this Mac, and optionally uploads it to TestFlight.4#   scripts/ios-release.sh archive | export | upload | all      (all = archive + export; upload is explicit)5# iOS apps are not notarized: distribution goes through App Store Connect / TestFlight.6# Nothing secret is printed. Increase CURRENT_PROJECT_VERSION in project.yml before each new upload.7set -euo pipefail8cd "$(dirname "$0")/.."9read -r KEY_ID ISSUER KEY <<<"$(cd scripts && python3 -c 'import asc; print(*asc.creds())')"10AUTH=(-allowProvisioningUpdates -authenticationKeyPath "$KEY" -authenticationKeyID "$KEY_ID" -authenticationKeyIssuerID "$ISSUER")11ARCHIVE="build/SPBrowserMobile.xcarchive"12mkdir -p build/logs dist13step="${1:-all}"1415if [[ "$step" == archive || "$step" == all ]]; then16  xcodegen generate --quiet17  rm -rf "$ARCHIVE"18  xcodebuild -project SPBrowser.xcodeproj -scheme SPBrowserMobile -configuration Release -destination "generic/platform=iOS" \19    -archivePath "$ARCHIVE" -derivedDataPath build/DerivedData-iOS-Release "${AUTH[@]}" archive > build/logs/ios-archive.log 2>&1 \20    || { grep -E "error:|\*\* " build/logs/ios-archive.log | sort -u | head -20; exit 1; }21  APP="$(ls -d "$ARCHIVE"/Products/Applications/*.app | head -1)"22  echo "archive : $(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$APP/Info.plist") ($(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$APP/Info.plist"))  $(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' "$APP/Info.plist")"23  codesign -d --entitlements - "$APP" 2>/dev/null | grep -A3 "associated-domains" | grep -o "webcredentials:[a-z.]*" || echo "WARNING: associated domains entitlement missing"24fi2526if [[ "$step" == export || "$step" == all ]]; then27  rm -rf dist/ios-export28  xcodebuild -exportArchive -archivePath "$ARCHIVE" -exportOptionsPlist scripts/ios-ExportOptions.plist -exportPath dist/ios-export "${AUTH[@]}" > build/logs/ios-export.log 2>&1 \29    || { grep -E "error:|\*\* " build/logs/ios-export.log | sort -u | head -20; exit 1; }30  ls -lh dist/ios-export/*.ipa31fi3233if [[ "$step" == upload ]]; then34  IPA="$(ls dist/ios-export/*.ipa | head -1)"35  xcrun altool --upload-app -f "$IPA" -t ios --apiKey "$KEY_ID" --apiIssuer "$ISSUER" 2>&1 | tee build/logs/ios-upload.log | grep -v -i "key\b" | tail -1236fi37
Files main
Menu

Theme