SPB Git

Repository Public

release.sh 3.0 KB 47 lines shellscript

1#!/usr/bin/env bash2# SP Drive iOS3# File: Scripts/release.sh4# Description: Release archive, App Store Connect signing, IPA export, validation and TestFlight upload.5#              usage: release.sh archive | export | validate | upload6#7# Author: Simon-Pierre Boucher8# Contact: contact@spboucher.ai9#10# The archive is signed with the Apple ID account configured in Xcode: App Groups (File Provider and share extensions) cannot be11# provisioned with an App Store Connect API key. The API key (already on this Mac, ~/.appstoreconnect/private_keys) is used for12# export, validation and upload. Nothing secret lives in the repository.13set -euo pipefail14cd "$(dirname "$0")/.."15KEY_ID="${ASC_KEY_ID:-L379BDKR69}"16ISSUER="${ASC_ISSUER_ID:-013e761f-e05c-4d93-a50b-f3d960adae4a}"17KEY="$HOME/.appstoreconnect/private_keys/AuthKey_${KEY_ID}.p8"18AUTH=(-allowProvisioningUpdates -authenticationKeyPath "$KEY" -authenticationKeyID "$KEY_ID" -authenticationKeyIssuerID "$ISSUER")19ARCHIVE="build/SPDrive.xcarchive"20mkdir -p build/logs dist21case "${1:-}" in22archive)23  Scripts/build.sh generate24  rm -rf "$ARCHIVE"25  xcodebuild -project SPDrive.xcodeproj -scheme SPDrive -configuration Release -destination "generic/platform=iOS" \26    -archivePath "$ARCHIVE" -derivedDataPath build/DerivedData-release -allowProvisioningUpdates archive > build/logs/archive.log 2>&1 \27    || { grep -E "error:|\*\* " build/logs/archive.log | sort -u | head -20; exit 1; }28  APP="$ARCHIVE/Products/Applications/SPDrive.app"29  echo "archive : $(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$APP/Info.plist") ($(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$APP/Info.plist"))"30  for b in "$APP" "$APP"/PlugIns/*.appex; do31    echo "== $(basename "$b")"; codesign -d --entitlements :- "$b" 2>/dev/null | plutil -p - | grep -E "application-identifier|associated-domains|application-groups|keychain-access-groups|get-task-allow" -A1 | grep -v "^--" | tr -s ' '32  done33  # no debug-only switch may survive in a Release binary34  if strings "$APP/SPDrive" | grep -q "SPDRIVE_TEST_TOKEN"; then echo "ERREUR : commutateur de test présent dans le binaire Release"; exit 1; fi35  if /usr/libexec/PlistBuddy -c 'Print :NSAppTransportSecurity:NSAllowsLocalNetworking' "$APP/Info.plist" | grep -q true; then echo "ERREUR : réseau local autorisé en Release"; exit 1; fi36  echo "contrôles Release : aucun commutateur de test, ATS strict" ;;37export)38  rm -rf dist/export39  xcodebuild -exportArchive -archivePath "$ARCHIVE" -exportOptionsPlist Scripts/ExportOptions.plist -exportPath dist/export "${AUTH[@]}" > build/logs/export.log 2>&1 \40    || { grep -E "error:|\*\* " build/logs/export.log | sort -u | head -20; exit 1; }41  ls -lh dist/export/*.ipa ;;42validate|upload)43  CMD=--validate-app; [ "$1" = upload ] && CMD=--upload-app44  xcrun altool "$CMD" -f "$(ls dist/export/*.ipa | head -1)" -t ios --apiKey "$KEY_ID" --apiIssuer "$ISSUER" 2>&1 | tee "build/logs/$1.log" | tail -20 ;;45*) echo "usage: $0 archive|export|validate|upload"; exit 2 ;;46esac47
Files main
Menu

Theme