Repository Public
1#!/usr/bin/env bash2# =============================================================================3# SP BOUCHER | SOFTWARE & RESEARCH4# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project : QYVORA8# File : App/Scripts/release.sh9# Module : Scripts10# Repository : https://git.spboucher.ai/qyvora11# Project Website : Not specified12# Created : 2026-12-0413# Last Modified : 2026-12-0414#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# QYVORA release pipeline: generate the project, archive, export an App Store build and upload it to TestFlight.43# Usage: Scripts/release.sh [archive|export|upload|all] (all = archive + export; upload is a separate, explicit step)44set -euo pipefail45cd "$(dirname "$0")/.."46KEY_ID="${ASC_KEY_ID:-L379BDKR69}"47ISSUER="${ASC_ISSUER_ID:-013e761f-e05c-4d93-a50b-f3d960adae4a}"48KEY="$HOME/.appstoreconnect/private_keys/AuthKey_${KEY_ID}.p8"49AUTH=(-allowProvisioningUpdates -authenticationKeyPath "$KEY" -authenticationKeyID "$KEY_ID" -authenticationKeyIssuerID "$ISSUER")50# Xcode writes signing metadata into its derived data: keep it outside the repository tree51DERIVED="${QY_DERIVED_DATA:-$HOME/Library/Caches/qyvora-release/DerivedData}"52ARCHIVE="build/Qyvora.xcarchive"53APP="$ARCHIVE/Products/Applications/Qyvora.app"54mkdir -p build/logs dist55step="${1:-all}"5657if [[ "$step" == archive || "$step" == all ]]; then58 if [[ -n "$(git status --porcelain -- .. 2>/dev/null | grep -v '^??' || true)" ]]; then59 echo "refusing to archive: uncommitted changes (the published build must be a committed revision)"; exit 160 fi61 xcodegen generate >/dev/null62 [[ -d "$ARCHIVE" ]] && mv "$ARCHIVE" "build/Qyvora-$(date +%s).old.xcarchive"63 xcodebuild -project Qyvora.xcodeproj -scheme Qyvora -configuration Release -destination "generic/platform=iOS" \64 -archivePath "$ARCHIVE" -derivedDataPath "$DERIVED" "${AUTH[@]}" archive > build/logs/archive.log 2>&1 \65 || { grep -E "error:|\*\* " build/logs/archive.log | sort -u | head -20; exit 1; }66 echo "archive : $(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$APP/Info.plist") ($(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$APP/Info.plist")) at $(git rev-parse --short HEAD)"67fi6869if [[ "$step" == export || "$step" == all ]]; then70 rm -rf dist/export dist/export-*.old71 xcodebuild -exportArchive -archivePath "$ARCHIVE" -exportOptionsPlist Scripts/ExportOptions.plist -exportPath dist/export "${AUTH[@]}" > build/logs/export.log 2>&1 \72 || { grep -E "error:|\*\* " build/logs/export.log | sort -u | head -20; exit 1; }73 # xcodebuild writes the App Store Connect session token into Packaging.log: never keep it74 rm -f dist/export/Packaging.log75 rm -rf dist/export-*.old76 ls -lh dist/export/*.ipa77fi7879if [[ "$step" == upload ]]; then80 IPA=$(ls dist/export/*.ipa | head -1)81 xcrun altool --upload-app -f "$IPA" -t ios --apiKey "$KEY_ID" --apiIssuer "$ISSUER" 2>&1 | tee build/logs/upload.log | tail -1582fi83