Repository Public
1#!/usr/bin/env bash2# =============================================================================3# SP BOUCHER | INFRASTRUCTURE & AUTOMATION4# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project : MacLustr SMS Gateway8# File : ios/Scripts/release.sh9# Description : Release archive, App Store Connect signing (automatic,10# team API key already on this Mac), IPA export, optional11# TestFlight upload. usage: release.sh archive | export |12# upload | all13# Module : ios14# Repository : https://git.spboucher.ai/maclustr-sms15# Project Website : https://sms.spboucher.ai16# Created : 2026-11-3017# Last Modified : 2026-11-3018#19# Author : Simon-Pierre Boucher20# Position : Professor of Finance21# Institution : Université du Québec en Outaouais (UQO)22# Organization : SP Boucher23# Website : https://spboucher.ai24# Git : https://git.spboucher.ai25#26# Preferred Contact: admin@spboucher.ai27# Technical Contact: dev@spboucher.ai28# Security/Admin : admin@spboucher.ai29#30# Copyright (c) 202631# Simon-Pierre Boucher32# All rights reserved where applicable. This file is governed by the33# applicable project license, copyright notices and relevant law.34# Existing third-party rights and notices remain unaffected.35#36# License : None specified (no license file in this repository)37#38# Do not embed credentials, private keys, access tokens,39# certificates or confidential personal information.40#41# =============================================================================42# END OF SP BOUCHER SOURCE HEADER43# =============================================================================4445set -euo pipefail46cd "$(dirname "$0")/.."47KEY_ID="${ASC_KEY_ID:-L379BDKR69}"48ISSUER="${ASC_ISSUER_ID:-013e761f-e05c-4d93-a50b-f3d960adae4a}"49KEY="$HOME/.appstoreconnect/private_keys/AuthKey_${KEY_ID}.p8"50AUTH=(-allowProvisioningUpdates -authenticationKeyPath "$KEY" -authenticationKeyID "$KEY_ID" -authenticationKeyIssuerID "$ISSUER")51ARCHIVE="build/MacLustrSMS.xcarchive"52mkdir -p build/logs dist53step="${1:-all}"5455if [[ "$step" == archive || "$step" == all ]]; then56 Scripts/build.sh generate57 rm -rf "$ARCHIVE"58 xcodebuild -project MacLustrSMS.xcodeproj -scheme MacLustrSMS -configuration Release -destination "generic/platform=iOS" \59 -archivePath "$ARCHIVE" -derivedDataPath build/DerivedData-release "${AUTH[@]}" archive > build/logs/archive.log 2>&1 \60 || { grep -E "error:|\*\* " build/logs/archive.log | sort -u | head -20; exit 1; }61 APP="$ARCHIVE/Products/Applications/MacLustrSMS.app"62 echo "archive : $(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$APP/Info.plist") ($(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$APP/Info.plist"))"63fi6465if [[ "$step" == export || "$step" == all ]]; then66 rm -rf dist/export67 xcodebuild -exportArchive -archivePath "$ARCHIVE" -exportOptionsPlist Scripts/ExportOptions.plist -exportPath dist/export "${AUTH[@]}" > build/logs/export.log 2>&1 \68 || { grep -E "error:|\*\* " build/logs/export.log | sort -u | head -20; exit 1; }69 ls -lh dist/export/*.ipa70fi7172if [[ "$step" == upload ]]; then73 # altool looks for the key in ~/.appstoreconnect/private_keys ; it validates then uploads to App Store Connect (TestFlight)74 xcrun altool --upload-app -f "dist/export/MacLustr SMS.ipa" -t ios --apiKey "$KEY_ID" --apiIssuer "$ISSUER" 2>&1 | tee build/logs/upload.log | tail -1575fi76