SPB Git

Repository Public BSD-3-Clause

release.sh 5.0 KB 95 lines shellscript

1#!/usr/bin/env bash2# =============================================================================3#                  SP BOUCHER | INFRASTRUCTURE & AUTOMATION4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project          : ORIX Maps8# File             : scripts/release.sh9# Module           : scripts10# Repository       : https://git.spboucher.ai/orix-maps11# Created          : 2026-11-2512# Last Modified    : 2026-11-2513#14# Author           : Simon-Pierre Boucher15# Position         : Professor of Finance16# Institution      : Université du Québec en Outaouais (UQO)17# Organization     : SP Boucher18# Website          : https://spboucher.ai19# Git              : https://git.spboucher.ai20#21# Preferred Contact: support@spboucher.ai22# Technical Contact: dev@spboucher.ai23# Security/Admin   : admin@spboucher.ai24#25# Copyright (c) 202626# Simon-Pierre Boucher27# All rights reserved where applicable. This file is governed by the28# applicable project license, copyright notices and relevant law.29# Existing third-party rights and notices remain unaffected.30#31# License          : Proprietary, all rights reserved (see license file)32# License File     : LICENSE33#34# Do not embed credentials, private keys, access tokens,35# certificates or confidential personal information.36#37# =============================================================================38# END OF SP BOUCHER SOURCE HEADER39# =============================================================================4041# ORIX Maps — release archive, App Store Connect export, validation and TestFlight upload.42# usage: scripts/release.sh archive | export | validate | upload | status43# Signing is automatic with the Apple ID account configured in Xcode on this Mac. The App Store Connect API key already44# installed in ~/.appstoreconnect/private_keys is used to validate, upload and read the build status; it is never copied.45# `upload` sends a build to App Store Connect (TestFlight). It requires ORIX_UPLOAD_AUTHORIZED=yes so that it cannot46# happen by accident. Nothing here submits anything to App Review.47set -euo pipefail48cd "$(dirname "$0")/.."49KEY_ID="${ASC_KEY_ID:-L379BDKR69}"50ISSUER="${ASC_ISSUER_ID:-013e761f-e05c-4d93-a50b-f3d960adae4a}"51APP_ID="6839106764"52ARCHIVE="build/ORIXMaps.xcarchive"53IPA="dist/export/ORIXMaps.ipa"54mkdir -p build/logs dist55step="${1:?usage: release.sh archive | export | validate | upload | status}"5657case "$step" in58archive)59  (cd Apps/ORIXMaps && xcodegen generate --quiet)60  rm -rf "$ARCHIVE"61  xcodebuild -project Apps/ORIXMaps/ORIXMaps.xcodeproj -scheme ORIXMaps -configuration Release -destination "generic/platform=iOS" \62    -archivePath "$ARCHIVE" -derivedDataPath build/DerivedData-release -allowProvisioningUpdates -skipPackagePluginValidation archive > build/logs/archive.log 2>&1 \63    || { grep -E "error:|\*\* " build/logs/archive.log | sort -u | head -20; exit 1; }64  APP="$ARCHIVE/Products/Applications/ORIXMaps.app"65  echo "archive: $(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$APP/Info.plist") ($(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$APP/Info.plist")), bundle $(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' "$APP/Info.plist"), $(du -sh "$APP" | cut -f1)"66  scripts/check.sh "$APP"67  ;;68export)69  rm -rf dist/export70  xcodebuild -exportArchive -archivePath "$ARCHIVE" -exportOptionsPlist scripts/ExportOptions.plist -exportPath dist/export -allowProvisioningUpdates > build/logs/export.log 2>&1 \71    || { grep -E "error:|\*\* " build/logs/export.log | sort -u | head -20; exit 1; }72  ls -lh dist/export/*.ipa73  ;;74validate)75  xcrun altool --validate-app -f "$IPA" -t ios --apiKey "$KEY_ID" --apiIssuer "$ISSUER" 2>&1 | tee build/logs/validate.log | tail -1576  ;;77upload)78  [ "${ORIX_UPLOAD_AUTHORIZED:-}" = "yes" ] || { echo "upload not authorized: set ORIX_UPLOAD_AUTHORIZED=yes for this build"; exit 3; }79  xcrun altool --upload-app -f "$IPA" -t ios --apiKey "$KEY_ID" --apiIssuer "$ISSUER" 2>&1 | tee build/logs/upload.log | tail -1580  ;;81status)82  python3 scripts/asc.py GET "/v1/builds?filter%5Bapp%5D=$APP_ID&sort=-uploadedDate&limit=5&fields%5Bbuilds%5D=version,processingState,uploadedDate,expired,usesNonExemptEncryption,minOsVersion&include=buildBetaDetail&fields%5BbuildBetaDetails%5D=internalBuildState,externalBuildState" \83    | python3 -c "84import json, sys85t = sys.stdin.read(); d = json.loads(t[t.index('{'):])86beta = {i['id']: i['attributes'] for i in d.get('included', [])}87for b in d.get('data', []):88    a = b['attributes']; x = beta.get(b['relationships']['buildBetaDetail']['data']['id'], {}) if b['relationships'].get('buildBetaDetail', {}).get('data') else {}89    print('build', a['version'], '|', a['processingState'], '| uploaded', a['uploadedDate'], '| internal', x.get('internalBuildState'), '| external', x.get('externalBuildState'), '| min iOS', a.get('minOsVersion'))90if not d.get('data'): print('no build on App Store Connect yet')91"92  ;;93*) echo "unknown step: $step"; exit 2 ;;94esac95
Files main
Menu

Theme