SPB Git

Repository Public

release.sh 3.5 KB 54 lines shellscript

1#!/usr/bin/env bash2# Food-Ka iOS v23# File: Scripts/release.sh4# Description: archive, export, validation et envoi App Store Connect.5#              usage : release.sh archive | export | record | validate | upload | wait | group | testflight6# L'archive est signée avec le compte Xcode (signature automatique) ; l'export, la validation et7# l'envoi utilisent la clé API App Store Connect déjà présente sur ce Mac8# (~/.appstoreconnect/private_keys). Aucun secret dans le dépôt.9#10# Author: Simon-Pierre Boucher11# Contact: contact@spboucher.ai12set -euo pipefail13cd "$(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/FoodKa.xcarchive"19mkdir -p build/logs dist20case "${1:-}" in21archive)22  Scripts/build.sh generate23  rm -rf "$ARCHIVE"24  xcodebuild -project FoodKa.xcodeproj -scheme FoodKa -configuration Release -destination "generic/platform=iOS" \25    -archivePath "$ARCHIVE" -derivedDataPath build/DerivedData-release "${AUTH[@]}" archive > build/logs/archive.log 2>&1 \26    || { grep -E "error:|\*\* " build/logs/archive.log | sort -u | head -20; exit 1; }27  APP="$ARCHIVE/Products/Applications/FoodKa.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  codesign -d --entitlements :- "$APP" 2>/dev/null | plutil -p - | grep -E "application-identifier|get-task-allow" -A0 | tr -s ' '30  # aucun réglage de développement ne doit survivre dans un binaire Release31  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; fi32  if strings "$APP/FoodKa" | grep -q "127.0.0.1"; then echo "ERREUR : adresse de développement présente dans le binaire Release"; exit 1; fi33  echo "contrôles Release : ATS strict, aucune adresse de développement" ;;34export)35  rm -rf dist/export36  xcodebuild -exportArchive -archivePath "$ARCHIVE" -exportOptionsPlist Scripts/ExportOptions.plist -exportPath dist/export "${AUTH[@]}" > build/logs/export.log 2>&1 \37    || { grep -E "error:|\*\* " build/logs/export.log | sort -u | head -20; exit 1; }38  ls -lh dist/export/*.ipa ;;39validate|upload)40  CMD=--validate-app; [ "$1" = upload ] && CMD=--upload-app41  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 ;;42record)43  # fiche App Store Connect (créée une fois dans App Store Connect : « Food-Ka v2 », SKU foodka-ios-v2, fr-CA) :44  # elle est simplement retrouvée par l'API45  python3 Scripts/asc.py app ;;46wait)  python3 Scripts/asc.py wait "$(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$ARCHIVE/Products/Applications/FoodKa.app/Info.plist")" ;;47group) python3 Scripts/asc.py group ;;48testflight)49  # chaîne complète après archive + export : fiche, validation, envoi, traitement, groupe interne50  "$0" record && "$0" validate && grep -q "VERIFY SUCCEEDED" build/logs/validate.log \51    && "$0" upload && grep -q "UPLOAD SUCCEEDED" build/logs/upload.log && "$0" wait && "$0" group ;;52*) echo "usage: $0 archive|export|record|validate|upload|wait|group|testflight"; exit 2 ;;53esac54
Files main
Menu

Theme