SPB Git

Repository Public

release-ios.sh 3.6 KB 49 lines shellscript

1#!/usr/bin/env bash2# Author: Simon-Pierre Boucher — contact@spboucher.ai3# File: Scripts/release-ios.sh4# Description: Release archive of SP Vault for iOS / iPadOS (app + AutoFill extension), App Store Connect signing,5#              IPA export, validation and TestFlight upload.6#              usage: release-ios.sh archive | export | validate | upload7#8# The archive is signed with the Apple ID account configured in Xcode: App Groups (shared by the app and the AutoFill9# extension) cannot be provisioned with an App Store Connect API key. The API key (already on this Mac,10# ~/.appstoreconnect/private_keys) is used for export, validation and upload. Nothing secret lives in the repository.11set -euo pipefail12export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"13cd "$(dirname "$0")/.."14KEY_ID="${ASC_KEY_ID:-L379BDKR69}"15ISSUER="${ASC_ISSUER_ID:-013e761f-e05c-4d93-a50b-f3d960adae4a}"16KEY="$HOME/.appstoreconnect/private_keys/AuthKey_${KEY_ID}.p8"17AUTH=(-allowProvisioningUpdates -authenticationKeyPath "$KEY" -authenticationKeyID "$KEY_ID" -authenticationKeyIssuerID "$ISSUER")18ARCHIVE="build/SPVault-iOS.xcarchive"; DD="${SPV_DD:-$HOME/Library/Developer/SPVault}/DerivedData-Release-iOS"19mkdir -p build/logs dist20case "${1:-}" in21archive)22  xcodegen generate --quiet23  rm -rf "$ARCHIVE"24  xcodebuild -project SPVault.xcodeproj -scheme SPVault-iOS -configuration Release -destination "generic/platform=iOS" \25    -archivePath "$ARCHIVE" -derivedDataPath "$DD" -allowProvisioningUpdates archive > build/logs/archive-ios.log 2>&1 \26    || { sed 's/\x1b\[[0-9;]*m//g' build/logs/archive-ios.log | grep -E "error:|\*\* " | sort -u | head -20; echo "ERROR: archive failed, see build/logs/archive-ios.log"; exit 1; }27  APP="$ARCHIVE/Products/Applications/SPVault.app"28  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")"29  for b in "$APP" "$APP"/PlugIns/*.appex; do30    echo "== $(basename "$b")"; codesign -d --entitlements :- "$b" 2>/dev/null | plutil -p - | grep -E "application-identifier|associated-domains|application-groups|keychain-access-groups|autofill-credential-provider|get-task-allow" -A1 | grep -v "^--" | tr -s ' '31  done32  # nothing of the development variant may survive in a Release binary33  for b in "$APP/SPVault" "$APP"/PlugIns/*.appex/SPVaultAutoFill; do34    if strings -a "$b" | grep -Eq "SPV_DEV_|dev-passkeys|dev-device-keys|SPVaultDev"; then echo "ERROR: development artefact (SPV_DEV) in $b"; exit 1; fi35  done36  if plutil -p "$APP/Info.plist" | grep -q "NSAllowsLocalNetworking"; then echo "ERROR: local networking allowed in Release"; exit 1; fi37  [[ "$(/usr/libexec/PlistBuddy -c 'Print :ITSAppUsesNonExemptEncryption' "$APP/Info.plist")" == "false" ]] || { echo "ERROR: ITSAppUsesNonExemptEncryption is not false"; exit 1; }38  echo "Release checks: no SPV_DEV artefact, strict ATS, ITSAppUsesNonExemptEncryption = false" ;;39export)40  rm -rf dist/export41  xcodebuild -exportArchive -archivePath "$ARCHIVE" -exportOptionsPlist Scripts/ExportOptions.plist -exportPath dist/export "${AUTH[@]}" > build/logs/export-ios.log 2>&1 \42    || { sed 's/\x1b\[[0-9;]*m//g' build/logs/export-ios.log | grep -E "error:|\*\* " | sort -u | head -20; exit 1; }43  ls -lh dist/export/*.ipa ;;44validate|upload)45  CMD=--validate-app; [ "$1" = upload ] && CMD=--upload-app46  xcrun altool "$CMD" -f "$(ls dist/export/*.ipa | head -1)" -t ios --apiKey "$KEY_ID" --apiIssuer "$ISSUER" 2>&1 | tee "build/logs/$1-ios.log" | tail -20 ;;47*) echo "usage: $0 archive|export|validate|upload"; exit 2 ;;48esac49
Files main
Menu

Theme