Repository Public
1#!/usr/bin/env bash2# =============================================================================3# SP BOUCHER | INFRASTRUCTURE & AUTOMATION4# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project : SP Keyboard8# File : Scripts/apple_dev_setup.sh9# Description : Apple Developer registration of SP Keyboard through the10# owner's signed-in Safari session. Default mode is a dry11# run (reads only). --apply creates what is missing, one12# idempotent step at a time, each followed by a read-back.13# --asc also creates the App Store Connect record. Nothing14# here reads a cookie, a password, a 2FA code or a private15# key. usage: apple_dev_setup.sh [--dry-run] | --apply16# [--asc]17# Module : Scripts18# Repository : https://git.spboucher.ai/sp-keyboard19# Created : 2026-12-0120# Last Modified : 2026-12-0121#22# Author : Simon-Pierre Boucher23# Position : Professor of Finance24# Institution : Université du Québec en Outaouais (UQO)25# Organization : SP Boucher26# Website : https://spboucher.ai27# Git : https://git.spboucher.ai28#29# Preferred Contact: support@spboucher.ai30# Technical Contact: dev@spboucher.ai31# Security/Admin : admin@spboucher.ai32#33# Copyright (c) 202634# Simon-Pierre Boucher35# All rights reserved where applicable. This file is governed by the36# applicable project license, copyright notices and relevant law.37# Existing third-party rights and notices remain unaffected.38#39# License : None specified (no license file in this repository)40#41# Do not embed credentials, private keys, access tokens,42# certificates or confidential personal information.43#44# =============================================================================45# END OF SP BOUCHER SOURCE HEADER46# =============================================================================4748set -euo pipefail49cd "$(dirname "$0")"50MODE=dry; ASC=051for arg in "$@"; do52 case "$arg" in53 --dry-run) MODE=dry ;;54 --apply) MODE=apply ;;55 --asc) ASC=1 ;;56 *) echo "usage: $0 [--dry-run] | --apply [--asc]"; exit 2 ;;57 esac58done59PORTAL_URL="https://developer.apple.com/account/resources/identifiers/list"60run_portal() { osascript apple_dev_setup.applescript "$PWD/portal/$1" developer.apple.com /account "$PORTAL_URL"; }61run_asc() { osascript apple_dev_setup.applescript "$PWD/portal/$1" appstoreconnect.apple.com / "https://appstoreconnect.apple.com/apps"; }62stop_on() { case "$1" in STOP*|ERR*|TIMEOUT*|USAGE*) echo "$1"; exit 1 ;; esac; }6364echo "== inventory ($(date -u +%Y-%m-%dT%H:%MZ)) =="65out="$(run_portal inventory.js)"; stop_on "$out"; echo "$out"66if [ "$MODE" = dry ]; then67 echo "dry run: nothing was changed. Run with --apply to create what is missing."68 exit 069fi70echo "== app group =="71out="$(run_portal create-app-group.js)"; stop_on "$out"; echo "$out"72echo "== app ids =="73out="$(run_portal create-app-ids.js)"; stop_on "$out"; echo "$out"74echo "== read-back =="75out="$(run_portal inventory.js)"; stop_on "$out"; echo "$out"76if [ "$ASC" = 1 ]; then77 echo "== app store connect record =="78 out="$(run_asc create-asc-record.js)"; stop_on "$out"; echo "$out"79fi80