SPB Git

Repository Public

release.sh 5.2 KB 89 lines shellscript

1#!/usr/bin/env bash2# =============================================================================3#                  SP BOUCHER | INFRASTRUCTURE & AUTOMATION4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project          : Lou-Ka iOS8# File             : Scripts/release.sh9# Description      : archive, export, validation et envoi App Store Connect.10#                    usage : release.sh archive | export | validate | upload |11#                    wait | group | status L'archive est signée avec le compte12#                    Xcode (signature automatique) ; l'export, la validation et13#                    l'envoi utilisent la clé API App Store Connect déjà14#                    présente sur ce Mac (~/.appstoreconnect/private_keys).15#                    Aucun secret dans le dépôt.16# Module           : Scripts17# Repository       : https://git.spboucher.ai/lou-ka-ios-v318# Project Website  : https://www.lou-ka.com19# Created          : 2026-11-2520# Last Modified    : 2026-11-2821#22# Author           : Simon-Pierre Boucher23# Position         : Professor of Finance24# Institution      : Université du Québec en Outaouais (UQO)25# Organization     : SP Boucher26# Website          : https://spboucher.ai27# Git              : https://git.spboucher.ai28#29# Preferred Contact: support@spboucher.ai30# Technical Contact: dev@spboucher.ai31# Security/Admin   : admin@spboucher.ai32#33# Copyright (c) 202634# Simon-Pierre Boucher35# All rights reserved where applicable. This file is governed by the36# applicable project license, copyright notices and relevant law.37# Existing third-party rights and notices remain unaffected.38#39# License          : None specified (no license file in this repository)40#41# Do not embed credentials, private keys, access tokens,42# certificates or confidential personal information.43#44# =============================================================================45# END OF SP BOUCHER SOURCE HEADER46# =============================================================================4748set -euo pipefail49cd "$(dirname "$0")/.."50KEY_ID="${ASC_KEY_ID:-L379BDKR69}"51ISSUER="${ASC_ISSUER_ID:-013e761f-e05c-4d93-a50b-f3d960adae4a}"52KEY="$HOME/.appstoreconnect/private_keys/AuthKey_${KEY_ID}.p8"53AUTH=(-allowProvisioningUpdates -authenticationKeyPath "$KEY" -authenticationKeyID "$KEY_ID" -authenticationKeyIssuerID "$ISSUER")54ARCHIVE="build/LouKa.xcarchive"55mkdir -p build/logs dist56case "${1:-}" in57archive)58  Scripts/build.sh generate59  rm -rf "$ARCHIVE"60  xcodebuild -project LouKa.xcodeproj -scheme LouKa -configuration Release -destination "generic/platform=iOS" \61    -archivePath "$ARCHIVE" -derivedDataPath build/DerivedData-release "${AUTH[@]}" archive > build/logs/archive.log 2>&1 \62    || { grep -E "error:|\*\* " build/logs/archive.log | sort -u | head -20; exit 1; }63  APP="$ARCHIVE/Products/Applications/LouKa.app"64  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")"65  codesign -d --entitlements :- "$APP" 2>/dev/null | plutil -p - | grep -E "application-identifier|get-task-allow" -A0 | tr -s ' '66  # aucun réglage de développement ne doit survivre dans un binaire Release67  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; fi68  if strings "$APP/LouKa" | grep -q "127.0.0.1"; then echo "ERREUR : adresse de développement présente dans le binaire Release"; exit 1; fi69  # l'extension de widgets est embarquée, à la même version, et le droit des liens universels est signé70  W="$APP/PlugIns/LouKaWidgets.appex"71  [ -d "$W" ] || { echo "ERREUR : extension de widgets absente de l'archive"; exit 1; }72  echo "widgets : $(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' "$W/Info.plist") $(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$W/Info.plist") ($(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$W/Info.plist"))"73  codesign -d --entitlements :- "$APP" 2>/dev/null | plutil -p - | grep -A3 "associated-domains" | tr -s ' '74  echo "contrôles Release : ATS strict, aucune adresse de développement, widgets embarqués" ;;75export)76  rm -rf dist/export77  xcodebuild -exportArchive -archivePath "$ARCHIVE" -exportOptionsPlist Scripts/ExportOptions.plist -exportPath dist/export "${AUTH[@]}" > build/logs/export.log 2>&1 \78    || { grep -E "error:|\*\* " build/logs/export.log | sort -u | head -20; exit 1; }79  ls -lh dist/export/*.ipa ;;80validate|upload)81  CMD=--validate-app; [ "$1" = upload ] && CMD=--upload-app82  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 ;;83wait|group|status)84  # état du build sur App Store Connect ; « group » le rattache au groupe interne seulement (aucune revue)85  N="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$ARCHIVE/Products/Applications/LouKa.app/Info.plist")"86  python3 Scripts/asc.py "$1" "$N" ;;87*) echo "usage: $0 archive|export|validate|upload|wait|group|status"; exit 2 ;;88esac89
Files main
Menu

Theme