SPB Git

Repository Public

release.sh 2.3 KB 43 lines shellscript

1#!/usr/bin/env bash2# SP Notes iOS3# File: Scripts/release.sh4# Description: Release archive, App Store Connect signing (automatic, team API key already on this Mac), IPA export, optional TestFlight upload.5#              usage: release.sh archive | export | upload | all6#7# Author: Simon-Pierre Boucher8# Contact: contact@spboucher.ai9set -euo pipefail10cd "$(dirname "$0")/.."11KEY_ID="${ASC_KEY_ID:-L379BDKR69}"12ISSUER="${ASC_ISSUER_ID:-013e761f-e05c-4d93-a50b-f3d960adae4a}"13KEY="$HOME/.appstoreconnect/private_keys/AuthKey_${KEY_ID}.p8"14# The archive is signed with the Apple ID account configured in Xcode: App Groups (widgets, share extension) cannot be provisioned with15# an App Store Connect API key ("Authentication failed" from the provisioning service). The key is used for export and upload.16XCODE_ACCOUNT=(-allowProvisioningUpdates)17AUTH=(-allowProvisioningUpdates -authenticationKeyPath "$KEY" -authenticationKeyID "$KEY_ID" -authenticationKeyIssuerID "$ISSUER")18ARCHIVE="build/SPNotes.xcarchive"19mkdir -p build/logs dist20step="${1:-all}"2122if [[ "$step" == archive || "$step" == all ]]; then23  Scripts/build.sh generate24  rm -rf "$ARCHIVE"25  xcodebuild -project SPNotes.xcodeproj -scheme SPNotes -configuration Release -destination "generic/platform=iOS" \26    -archivePath "$ARCHIVE" -derivedDataPath build/DerivedData-release "${XCODE_ACCOUNT[@]}" 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/SPNotes.app"29  echo "archive : $(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$APP/Info.plist") ($(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$APP/Info.plist"))"30fi3132if [[ "$step" == export || "$step" == all ]]; then33  rm -rf dist/export34  xcodebuild -exportArchive -archivePath "$ARCHIVE" -exportOptionsPlist Scripts/ExportOptions.plist -exportPath dist/export "${AUTH[@]}" > build/logs/export.log 2>&1 \35    || { grep -E "error:|\*\* " build/logs/export.log | sort -u | head -20; exit 1; }36  ls -lh dist/export/*.ipa37fi3839if [[ "$step" == upload ]]; then40  # altool looks for the key in ~/.appstoreconnect/private_keys ; it validates then uploads to App Store Connect (TestFlight)41  xcrun altool --upload-app -f "dist/export/SP Notes.ipa" -t ios --apiKey "$KEY_ID" --apiIssuer "$ISSUER" 2>&1 | tee build/logs/upload.log | tail -1542fi43
Files main
Menu

Theme