Repository Public
1#!/usr/bin/env bash2# =============================================================================3# SP BOUCHER | SOFTWARE & RESEARCH4# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project : SP ID & Card Vault8# File : scripts/release.sh9# Module : Scripts10# Repository : https://git.spboucher.ai/sp-id-card-vault11# Project Website : Not specified12# Created : 2026-12-0213# Last Modified : 2026-12-0214#15# Author : Simon-Pierre Boucher16# Position : Professor of Finance17# Institution : Université du Québec en Outaouais (UQO)18# Organization : SP Boucher19# Website : https://spboucher.ai20# Git : https://git.spboucher.ai21#22# Preferred Contact: contact@spboucher.ai23# Development : dev@spboucher.ai24# Support : support@spboucher.ai25# Security/Admin : admin@spboucher.ai26#27# Copyright (c) 202628# Simon-Pierre Boucher29# All rights reserved where applicable. This file is governed by the30# applicable project license, copyright notices and relevant law.31# Existing third-party rights and notices remain unaffected.32#33# License : None specified (no license file in this repository)34#35# Do not embed credentials, private keys, access tokens,36# certificates or confidential personal information.37#38# =============================================================================39# END OF SP BOUCHER SOURCE HEADER40# =============================================================================4142# TestFlight (internal only) release steps. usage: scripts/release.sh archive|export|upload|status|wait|group43set -euo pipefail44cd "$(dirname "$0")/.."45# App Store Connect API key identifiers are kept out of the repository:46# ~/.appstoreconnect/asc.env defines ASC_KEY_ID and ASC_ISSUER_ID (the .p8 sits beside it).47[ -f "$HOME/.appstoreconnect/asc.env" ] && { set -a; . "$HOME/.appstoreconnect/asc.env"; set +a; }48KEY_ID="${ASC_KEY_ID:-}"49ISSUER="${ASC_ISSUER_ID:-}"50ARCHIVE=build/SPVault.xcarchive51APP="$ARCHIVE/Products/Applications/SPVault.app"52mkdir -p build/logs dist53plist() { /usr/libexec/PlistBuddy -c "Print :$2" "$1"; }54case "${1:-}" in55archive)56 xcodegen generate --quiet57 rm -rf "$ARCHIVE"58 xcodebuild archive -project SPVault.xcodeproj -scheme SPVault -configuration Release -destination "generic/platform=iOS" \59 -archivePath "$ARCHIVE" -derivedDataPath build/dd-release -allowProvisioningUpdates > build/logs/archive.log 2>&1 \60 || { grep -E "error:|\*\* " build/logs/archive.log | sort -u | head -20; exit 1; }61 echo "archive: $(plist "$APP/Info.plist" CFBundleDisplayName) $(plist "$APP/Info.plist" CFBundleShortVersionString) ($(plist "$APP/Info.plist" CFBundleVersion))"62 codesign --verify --strict "$APP" && echo "signature ok"63 if strings -a "$APP/SPVault" | grep -qE "ScriptedKeyProtector|SimulatorKeyProtector|DemoCardFactory|uiTesting"; then echo "ERROR: test hooks in the Release binary"; exit 1; fi64 echo "network symbols: $(nm -u "$APP/SPVault" | grep -c -i -E "URLSession|CFNetwork|nw_connection" || true)" ;;65export)66 rm -rf dist/export67 xcodebuild -exportArchive -archivePath "$ARCHIVE" -exportOptionsPlist scripts/ExportOptions.plist -exportPath dist/export -allowProvisioningUpdates > 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/*.ipa ;;70validate|upload)71 [ -n "$KEY_ID" ] && [ -n "$ISSUER" ] || { echo "ASC_KEY_ID / ASC_ISSUER_ID missing (see ~/.appstoreconnect/asc.env)"; exit 1; }72 CMD=--validate-app; [ "$1" = upload ] && CMD=--upload-app73 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 ;;74status|group|wait)75 SPV_VERSION="$(plist "$APP/Info.plist" CFBundleShortVersionString)" python3 scripts/asc.py "$1" "$(plist "$APP/Info.plist" CFBundleVersion)" ;;76*) echo "usage: $0 archive|export|validate|upload|status|wait|group"; exit 2 ;;77esac78