subrascasse

Sub Rascasse: an iPhone dive log for Subsurface cloud storage, with a pure-Swift git client (GPL-2.0)
git clone https://git.schurger.org/subrascasse.git
Log | Files | Refs | README | LICENSE

commit 990004675a4f1a2c04db41e3b371c1258c51f0c3
parent 26a4045f7bc5356043916b192fd5c07f0e961b9f
Author: Jean Schurger <jean@schurger.org>
Date:   Fri, 13 Nov 2026 16:36:10 -0500

TestFlight: archive, upload and tester setup (make archive, upload, beta-setup)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K7deYG3yp7VDUZJzSBkvTc

Diffstat:
MMakefile | 18++++++++++++++++++
Afastlane/Appfile | 3+++
Afastlane/Fastfile | 93+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atools/ExportOptions.plist | 16++++++++++++++++
4 files changed, 130 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile @@ -33,3 +33,21 @@ APP_ID = org.schurger.subrascasse shot: @ssh $(CHUNGA) 'cd $(REMOTE) && xcrun simctl bootstatus "$(SIM)" -b >/dev/null && xcrun simctl install "$(SIM)" build/Build/Products/Debug-iphonesimulator/DiveLog.app && (xcrun simctl terminate "$(SIM)" $(APP_ID) 2>/dev/null; true) && xcrun simctl launch "$(SIM)" $(APP_ID) $(DEMO) -AppleLanguages "(fr)" -AppleLocale fr_CA $(ARGS) >/dev/null && sleep $(WAIT) && mkdir -p build/shots && xcrun simctl io "$(SIM)" screenshot build/shots/$(SHOT).png 2>/dev/null && sips -Z 1100 build/shots/$(SHOT).png --out build/shots/$(SHOT)-small.png >/dev/null' @mkdir -p build/shots && scp -q $(CHUNGA):$(REMOTE)/build/shots/$(SHOT)-small.png build/shots/$(SHOT).png + +# Archive signée pour TestFlight (signature automatique, clé API perso de chunga). BUILD=n fixe le numéro ; +# chaque build a son dossier build/tf-<numéro>. +BUILD ?= $(shell date +%Y%m%d%H%M) +OUT = build/tf-$(BUILD) +AUTH = -allowProvisioningUpdates -authenticationKeyPath $$PERSO_ASC_KEY_PATH -authenticationKeyID $$PERSO_ASC_KEY_ID -authenticationKeyIssuerID $$PERSO_ASC_ISSUER_ID + +.PHONY: archive upload beta-setup +archive: project + ssh $(CHUNGA) 'source ~/.zshrc_build && security unlock-keychain -p "$$(cat ~/.keyring_secret)" ~/Library/Keychains/login.keychain-db && cd $(REMOTE) && xcodebuild -quiet -scheme DiveLog -configuration Release -destination "generic/platform=iOS" -archivePath $(OUT)/DiveLog.xcarchive CURRENT_PROJECT_VERSION=$(BUILD) $(AUTH) archive && PATH=/usr/bin:$$PATH xcodebuild -quiet -exportArchive -archivePath $(OUT)/DiveLog.xcarchive -exportOptionsPlist tools/ExportOptions.plist -exportPath $(OUT)/ipa $(AUTH) && ls -la $(OUT)/ipa' + +# Envoi sur TestFlight de l'IPA archivée, avec le même BUILD (altool cherche la clé dans API_PRIVATE_KEYS_DIR). +upload: + ssh $(CHUNGA) 'source ~/.zshrc_build && cd $(REMOTE) && API_PRIVATE_KEYS_DIR=$$(dirname $$PERSO_ASC_KEY_PATH) xcrun altool --upload-app -f $(OUT)/ipa/DiveLog.ipa -t ios --apiKey $$PERSO_ASC_KEY_ID --apiIssuer $$PERSO_ASC_ISSUER_ID' + +# Groupe « Interne », textes TestFlight et notes de la dernière build. +beta-setup: sync + ssh $(CHUNGA) 'source ~/.zshrc_build && cd $(REMOTE) && fastlane ios beta_setup' diff --git a/fastlane/Appfile b/fastlane/Appfile @@ -0,0 +1,3 @@ +app_identifier("org.schurger.subrascasse") +apple_id(ENV["PERSO_APPLE_ID"]) +team_id("CM5RQKJH56") diff --git a/fastlane/Fastfile b/fastlane/Fastfile @@ -0,0 +1,93 @@ +require "tmpdir" + +default_platform(:ios) + +# Compte développeur perso (équipe CM5RQKJH56), clé App Store Connect lue dans ~/.zshrc_build de chunga. +APP_ID = "org.schurger.subrascasse" + +def api_key + app_store_connect_api_key( + key_id: ENV["PERSO_ASC_KEY_ID"], + issuer_id: ENV["PERSO_ASC_ISSUER_ID"], + key_filepath: ENV["PERSO_ASC_KEY_PATH"], + ) +end + +def xcode_auth + [ + "-allowProvisioningUpdates", + "-authenticationKeyPath", ENV["PERSO_ASC_KEY_PATH"], + "-authenticationKeyID", ENV["PERSO_ASC_KEY_ID"], + "-authenticationKeyIssuerID", ENV["PERSO_ASC_ISSUER_ID"], + ] +end + +platform :ios do + def asc(method, path, body = nil) + require "net/http" + uri = URI(path.start_with?("http") ? path : "https://api.appstoreconnect.apple.com#{path}") + klass = { get: Net::HTTP::Get, post: Net::HTTP::Post, patch: Net::HTTP::Patch }[method] + req = klass.new(uri, "Content-Type" => "application/json", "Authorization" => "Bearer #{Spaceship::ConnectAPI.token.text}") + req.body = body.to_json if body + res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |h| h.request(req) } + [res.code.to_i, (JSON.parse(res.body) rescue {})] + end + + desc "Groupe de testeurs internes, textes TestFlight et notes de la dernière build" + lane :beta_setup do + api_key + app = Spaceship::ConnectAPI::App.find(APP_ID) + _, groups = asc(:get, "/v1/apps/#{app.id}/betaGroups") + group = groups["data"].find { |g| g["attributes"]["name"] == "Interne" } + unless group + # POST brut : spaceship envoie publicLinkLimitEnabled, refusé pour un groupe interne. + c, r = asc(:post, "/v1/betaGroups", { data: { type: "betaGroups", + attributes: { name: "Interne", isInternalGroup: true, hasAccessToAllBuilds: true }, + relationships: { app: { data: { type: "apps", id: app.id } } } } }) + UI.message("GROUPE Interne -> #{c} #{(r["errors"] || []).map { |e| e["detail"] }.join(" ; ")}") + group = r["data"] + end + email = ENV["PERSO_APPLE_ID"] || "jean@schurger.org" + _, testers = asc(:get, "/v1/betaTesters?filter[email]=#{email}&filter[apps]=#{app.id}") + if testers["data"].empty? + c, r = asc(:post, "/v1/betaTesters", { data: { type: "betaTesters", attributes: { email: email, firstName: "Jean", lastName: "Schurger" }, + relationships: { betaGroups: { data: [{ type: "betaGroups", id: group["id"] }] } } } }) + UI.message("TESTEUR #{email} -> #{c} #{(r["errors"] || []).map { |e| e["detail"] }.join(" ; ")}") + else + UI.message("TESTEUR #{email} déjà présent") + end + texts = { + "fr-CA" => ["Votre carnet de plongée Subsurface sur iPhone : lecture, profils, modification hors ligne, synchronisation avec le nuage Subsurface. Application indépendante de l'équipe de Subsurface.", + "0.1 : première build. Se connecter avec le compte du nuage Subsurface (ou « Essayer avec un carnet de démonstration »). À vérifier : le carnet se télécharge en entier, les profils s'affichent, puis une petite modification (une note) se retrouve dans Subsurface."], + "en-CA" => ["Your Subsurface dive log on iPhone: browse, profiles, offline editing, sync with Subsurface cloud storage. Independent from the Subsurface team.", + "0.1: first build. Sign in with your Subsurface cloud account (or try the demo dive log). Check that the whole log downloads, profiles show, then that a small edit (a note) shows up in Subsurface."], + } + _, locs = asc(:get, "/v1/apps/#{app.id}/betaAppLocalizations") + texts.each do |locale, (description, _)| + existing = locs["data"].find { |l| l["attributes"]["locale"] == locale } + attrs = { description: description, feedbackEmail: email } + c, r = if existing + asc(:patch, "/v1/betaAppLocalizations/#{existing["id"]}", { data: { type: "betaAppLocalizations", id: existing["id"], attributes: attrs } }) + else + asc(:post, "/v1/betaAppLocalizations", { data: { type: "betaAppLocalizations", attributes: attrs.merge(locale: locale), + relationships: { app: { data: { type: "apps", id: app.id } } } } }) + end + UI.message("BETA #{locale} -> #{c} #{(r["errors"] || []).map { |e| e["detail"] }.join(" ; ")}") + end + _, builds = asc(:get, "/v1/builds?filter[app]=#{app.id}&sort=-uploadedDate&limit=1") + build = builds["data"].first + UI.user_error!("Aucune build encore visible") unless build + UI.message("BUILD #{build["attributes"]["version"]} #{build["attributes"]["processingState"]}") + _, blocs = asc(:get, "/v1/builds/#{build["id"]}/betaBuildLocalizations") + texts.each do |locale, (_, what)| + existing = blocs["data"].find { |l| l["attributes"]["locale"] == locale } + c, r = if existing + asc(:patch, "/v1/betaBuildLocalizations/#{existing["id"]}", { data: { type: "betaBuildLocalizations", id: existing["id"], attributes: { whatsNew: what } } }) + else + asc(:post, "/v1/betaBuildLocalizations", { data: { type: "betaBuildLocalizations", attributes: { locale: locale, whatsNew: what }, + relationships: { build: { data: { type: "builds", id: build["id"] } } } } }) + end + UI.message("A TESTER #{locale} -> #{c} #{(r["errors"] || []).map { |e| e["detail"] }.join(" ; ")}") + end + end +end diff --git a/tools/ExportOptions.plist b/tools/ExportOptions.plist @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>method</key> + <string>app-store-connect</string> + <key>destination</key> + <string>export</string> + <key>signingStyle</key> + <string>automatic</string> + <key>teamID</key> + <string>CM5RQKJH56</string> + <key>uploadSymbols</key> + <true/> +</dict> +</plist>