Repository Public MIT
1#!/usr/bin/env bash2# =============================================================================3# SP BOUCHER | INFRASTRUCTURE & AUTOMATION4# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project : ORIX Calc8# File : Scripts/release.sh9# Description : Release archive, App Store Connect export (automatic10# signing with the team API key on this Mac) and, only on11# explicit request, TestFlight upload. usage: release.sh12# archive | export | validate | upload13# Module : Scripts14# Repository : https://git.spboucher.ai/orix-calc15# Created : 2026-11-2016# Last Modified : 2026-11-2017#18# Author : Simon-Pierre Boucher19# Position : Professor of Finance20# Institution : Université du Québec en Outaouais (UQO)21# Organization : SP Boucher22# Website : https://spboucher.ai23# Git : https://git.spboucher.ai24#25# Preferred Contact: support@spboucher.ai26# Technical Contact: dev@spboucher.ai27# Security/Admin : admin@spboucher.ai28#29# Copyright (c) 202630# Simon-Pierre Boucher31# All rights reserved where applicable. This file is governed by the32# applicable project license, copyright notices and relevant law.33# Existing third-party rights and notices remain unaffected.34#35# License : Proprietary, all rights reserved (see license file)36# License File : LICENSE37#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/ORIXCalc.xcarchive"52IPA="dist/export/ORIX Calc.ipa"53mkdir -p build/logs dist54step="${1:?usage: release.sh archive | export | validate | upload}"5556case "$step" in57archive)58 Scripts/generate.sh59 rm -rf "$ARCHIVE"60 xcodebuild -project ORIXCalc.xcodeproj -scheme ORIXCalc -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/ORIXCalc.app"64 echo "archive: $(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$APP/Info.plist") ($(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$APP/Info.plist"))"65 ;;66export)67 rm -rf dist/export68 xcodebuild -exportArchive -archivePath "$ARCHIVE" -exportOptionsPlist Scripts/ExportOptions.plist -exportPath dist/export "${AUTH[@]}" > build/logs/export.log 2>&1 \69 || { grep -E "error:|\*\* " build/logs/export.log | sort -u | head -20; exit 1; }70 ls -lh dist/export/*.ipa71 ;;72validate)73 # Validation needs the app record to exist in App Store Connect; it uploads nothing.74 xcrun altool --validate-app -f "$IPA" -t ios --apiKey "$KEY_ID" --apiIssuer "$ISSUER" 2>&1 | tee build/logs/validate.log | tail -1575 ;;76upload)77 # Run only after the owner has explicitly authorised the upload.78 xcrun altool --upload-app -f "$IPA" -t ios --apiKey "$KEY_ID" --apiIssuer "$ISSUER" 2>&1 | tee build/logs/upload.log | tail -1579 ;;80*) echo "unknown step: $step"; exit 2 ;;81esac82