open-remora

Open Remora, a free secondary dive computer for Apple Watch Ultra
git clone https://git.schurger.org/open-remora.git
Log | Files | Refs | README | LICENSE

commit 1661a36f14b587892f48c0d876217d5fbdc4efd0
parent 556ff137e1baae71476fb8c989ba14b1d8951423
Author: Jean Schurger <jean@schurger.org>
Date:   Fri, 13 Nov 2026 14:56:00 -0500

TestFlight: internal tester group and texts (fastlane beta_setup)

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

Diffstat:
Afastlane/Appfile | 3+++
Afastlane/Fastfile | 93+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 96 insertions(+), 0 deletions(-)

diff --git a/fastlane/Appfile b/fastlane/Appfile @@ -0,0 +1,3 @@ +app_identifier("org.schurger.openremora") +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.openremora" + +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" => ["Ordinateur de plongée secondaire, libre et gratuit, pour Apple Watch Ultra. Non certifié : à porter avec un ordinateur principal.", + "0.1 : première build. À essayer à sec sur la montre : « Plongée de démonstration » (en bas de l'accueil), puis le carnet : ouvrir une plongée, toucher le profil et le parcourir à la couronne. Réglages : oxygène, eau, prudence."], + "en-CA" => ["Free, open-source backup dive computer for Apple Watch Ultra. Not certified: wear it with a primary dive computer.", + "0.1: first build. Try it dry on the watch: \"Plongée de démonstration\" (bottom of the home screen), then the log: open a dive, tap the profile and scroll it with the Digital Crown. Settings: oxygen, water, conservatism."], + } + _, 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