oficina / base Public

Add the release scripts: Mac through Sparkle, iPhone to TestFlight

release-mac.sh is release-equipo-0.1.5.sh for Base: a release build in
Timeless Sans, signed with Developer ID and Base's profile, notarized,
stapled and checked by Gatekeeper (the embedded profile, the font and
Base's four entitlements too), then published to native-releases'
base/appcast.xml as the claude agent. testflight.sh is
agent-tools/equipo-tf/testflight.sh for Base: an App Store archive of
the commit in a detached worktree, with Base's profile ("Oficina Base
iOS App Store 2026-11-23"), exported and uploaded with the App Store
Connect key.

Both only plan by default: they check what they can without signing and
print every command. --publish and --upload act. Both plans pass here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 7b66d99b4109c84341e85b99f921b9988ff59a63 parent bda89ae
2 files changed, +237 −0
  • native/scripts/release-mac.sh +152 −0
  • native/scripts/testflight.sh +85 −0
diff --git a/native/scripts/release-mac.sh b/native/scripts/release-mac.sh
new file mode 100755
index 0000000..dedab93
--- /dev/null
+++ b/native/scripts/release-mac.sh
@@ -0,0 +1,152 @@
+#!/bin/zsh
+# Base for the Mac, released: a release build set in Timeless Sans, signed
+# with Developer ID (Base's profile embedded), notarized, stapled, checked
+# by Gatekeeper, then published to the Sparkle feed on
+# oficina/native-releases (base/appcast.xml) with the archive as a release
+# asset. Adapted from release-equipo-0.1.5.sh (2026-11-19).
+#
+# native/scripts/release-mac.sh VERSION BUILD # the plan
+# native/scripts/release-mac.sh VERSION BUILD --publish # do it
+#
+# The plan (the default) checks what it can without signing (a clean tree
+# at a pushed commit, the pinned Timeless Sans, the configuration, the
+# Sparkle tools and the publisher) and prints every command it would run.
+# --publish runs them: the signing identity, Sparkle key, notary profile
+# and Base's Developer ID profile (Paul's portal steps) must be on this
+# Mac. Safe to rerun: a notarized release already in the record directory
+# is reused, and the publisher refuses a build the feed already lists.
+set -e -u -o pipefail
+setopt no_nomatch
+
+VERSION=${1:?usage: release-mac.sh VERSION BUILD [--publish]}
+BUILD=${2:?usage: release-mac.sh VERSION BUILD [--publish]}
+PUBLISH=0
+[[ ${3:-} == --publish ]] && PUBLISH=1
+[[ -z ${3:-} || $PUBLISH == 1 ]] || { print "usage: release-mac.sh VERSION BUILD [--publish]" >&2; exit 2 }
+
+IDENTITY='Developer ID Application: Team Tito Limited (9U4A84C4WK)'
+TEAM=9U4A84C4WK
+NOTARY_PROFILE=${NOTARY_PROFILE:-slopbox-notary}
+SPARKLE_ACCOUNT=oficina
+NATIVE=${0:A:h:h}
+REPO=${NATIVE:h}
+CONFIG=$NATIVE/mac-updates.json
+TOOLS=$NATIVE/apple/.build/checkouts/native/tools
+SPARKLE_BIN=$NATIVE/apple/.build/artifacts/sparkle/Sparkle/bin
+APP="$NATIVE/build/Oficina Base.app"
+OFICINA=$HOME/amadan.net/oficina
+RECORD=$OFICINA/sparkle-worktrees/releases/base-$VERSION-$BUILD
+ARTIFACTS=$OFICINA/sparkle-worktrees/native-releases
+AGENT_HOME=$HOME/.amadan-claude-agent
+AGENT_EMAIL='claude~paul@keymail.dev'
+umask 077
+TMP=$(mktemp -d "${TMPDIR:-/tmp}/base-release.XXXXXX")
+PAT_ID=""
+
+say() { print -r -- " $*" }
+step() { print -P "\n%B%F{cyan}==> $*%f%b" }
+die() { print -P "%F{red}error:%f $*" >&2; exit 1 }
+run() { print -r -- " + ${(j: :)${(q-)@}}"; [[ $PUBLISH == 0 ]] || "$@" }
+agent_amadan() { env AMADAN_HOME="$AGENT_HOME" amadan "$@" }
+agent_git() {
+ env AMADAN_HOME="$AGENT_HOME" GIT_ASKPASS="$TMP/askpass" GIT_TERMINAL_PROMPT=0 \
+ GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=credential.helper GIT_CONFIG_VALUE_0= \
+ GIT_AUTHOR_NAME=Claude GIT_AUTHOR_EMAIL="$AGENT_EMAIL" \
+ GIT_COMMITTER_NAME=Claude GIT_COMMITTER_EMAIL="$AGENT_EMAIL" "$@"
+}
+on_exit() {
+ local rc=$?
+ if [[ -n $PAT_ID ]]; then agent_amadan tokens revoke "$PAT_ID" >/dev/null && say "revoked PAT $PAT_ID" || print -P "%F{red}REVOKE PAT $PAT_ID BY HAND%f" >&2; fi
+ rm -rf "$TMP"
+ (( rc == 0 )) || print -P "%F{red}FAILED (exit $rc)%f" >&2
+}
+trap on_exit EXIT
+
+[[ $PUBLISH == 1 ]] && say "publishing Base $VERSION ($BUILD)" || say "the plan for Base $VERSION ($BUILD); --publish runs it"
+[[ $VERSION == <->.<->.<-> ]] || die "VERSION is not x.y.z"
+[[ $BUILD == <-> && $BUILD -ge 1 ]] || die "BUILD is not a positive integer"
+
+step "The tree: clean, at a pushed commit"
+COMMIT=$(git -C "$REPO" rev-parse HEAD)
+if [[ -n $(git -C "$REPO" status --porcelain) ]]; then
+ [[ $PUBLISH == 1 ]] && die "$REPO has local changes" || say "WARNING: local changes (--publish refuses them)"
+fi
+if ! git -C "$REPO" branch -r --contains "$COMMIT" | grep -q .; then
+ [[ $PUBLISH == 1 ]] && die "$COMMIT is on no remote branch" || say "WARNING: $COMMIT is on no remote branch (--publish refuses it)"
+fi
+say "commit $COMMIT"
+
+step "Timeless Sans, the configuration, the Sparkle tools and the publisher"
+"$REPO/hack/fonts.sh" check
+python3 -c 'import json,sys; c=json.load(open(sys.argv[1])); assert c["bundle_id"]=="works.oficina.base", c["bundle_id"]; print(" config:", c["feed_url"])' "$CONFIG"
+swift package --package-path "$NATIVE/apple" resolve >/dev/null
+[[ -x $SPARKLE_BIN/sign_update && -f $TOOLS/release_mac.py && -f $TOOLS/publish_mac_update.py ]] || die "Sparkle tools or the kit's release tools missing"
+say "all present"
+
+step "Signing: Developer ID, Sparkle key, notary profile, Base's profile"
+profile=${$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["provisioning_profile"])' "$CONFIG")/#\~/$HOME}
+if [[ $PUBLISH == 1 ]]; then
+ [[ $(security find-identity -v -p codesigning) == *"\"$IDENTITY\""* ]] || die "no '$IDENTITY'"
+ key=$("$SPARKLE_BIN/generate_keys" --account "$SPARKLE_ACCOUNT" -p)
+ [[ $key == $(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["public_ed_key"])' "$CONFIG") ]] || die "Sparkle key does not match mac-updates.json"
+ xcrun notarytool history --keychain-profile "$NOTARY_PROFILE" >/dev/null || die "notary profile did not authenticate"
+ [[ -f $profile ]] || die "no Developer ID profile at $profile (Paul's portal step)"
+ say "all present"
+else
+ say "checked only with --publish: '$IDENTITY', the Sparkle key ($SPARKLE_ACCOUNT), notary profile $NOTARY_PROFILE"
+ [[ -f $profile ]] && say "Developer ID profile present" || say "WARNING: no Developer ID profile at $profile yet (Paul's portal step)"
+fi
+
+if [[ -f $RECORD/release.json ]]; then
+ step "Reusing the notarized release in $RECORD"
+else
+ step "Build Oficina Base.app $VERSION ($BUILD), release, Developer ID"
+ run "$NATIVE/scripts/build-mac.sh" --configuration release --version "$VERSION" --build "$BUILD" --sign-identity "$IDENTITY"
+ if [[ $PUBLISH == 1 ]]; then
+ [[ $(plutil -extract CFBundleShortVersionString raw -o - "$APP/Contents/Info.plist") == $VERSION ]] || die "version mismatch"
+ [[ $(plutil -extract CFBundleVersion raw -o - "$APP/Contents/Info.plist") == $BUILD ]] || die "build mismatch"
+ [[ $(plutil -extract CFBundleIdentifier raw -o - "$APP/Contents/Info.plist") == works.oficina.base ]] || die "bundle id mismatch"
+ fi
+ step "Sign inside out, notarize, staple, Gatekeeper, Sparkle archive"
+ run python3 "$TOOLS/release_mac.py" "$APP" --config "$CONFIG" --sparkle-tools "$SPARKLE_BIN" \
+ --identity "$IDENTITY" --team "$TEAM" --notary-profile "$NOTARY_PROFILE" --output "$RECORD"
+fi
+
+step "Smoke test: the stapled app passes Gatekeeper, with Oficina ID's grants"
+SMOKE=$TMP/smoke; mkdir -p "$SMOKE"
+zip="$RECORD/works.oficina.base-$BUILD.zip"
+run ditto -x -k "$zip" "$SMOKE"
+run xcrun stapler validate "$SMOKE/Oficina Base.app"
+run spctl --assess --type execute -vv "$SMOKE/Oficina Base.app"
+if [[ $PUBLISH == 1 ]]; then
+ [[ -f "$SMOKE/Oficina Base.app/Contents/embedded.provisionprofile" ]] || die "no embedded provisioning profile"
+ [[ -f "$SMOKE/Oficina Base.app/Contents/Resources/BaseNative_BaseKit.bundle/Fonts/TimelessSansVF.woff2" ]] || die "Timeless Sans is not in the bundle"
+ ents=$(codesign -d --entitlements - --xml "$SMOKE/Oficina Base.app" 2>/dev/null | plutil -convert json -o - -)
+ for want in 9U4A84C4WK.works.oficina.base 9U4A84C4WK.works.oficina.id 9U4A84C4WK.works.oficina webcredentials:id.oficina.works; do
+ [[ $ents == *"\"$want\""* ]] || die "entitlement $want missing"
+ done
+ say "entitlements, embedded profile and Timeless Sans present"
+else
+ say "(checks the embedded profile, Timeless Sans in the bundle, and Base's four entitlements)"
+fi
+
+step "Publish: plan, then publish as the claude agent"
+if [[ $PUBLISH == 1 ]]; then
+ [[ $(agent_amadan auth whoami) == $AGENT_EMAIL ]] || die "agent credential is not $AGENT_EMAIL"
+ [[ -d $ARTIFACTS/.git || -f $ARTIFACTS/.git ]] || die "no native-releases checkout at $ARTIFACTS"
+ [[ -d $ARTIFACTS/base ]] || die "native-releases has no base/ yet (an operator step)"
+ LABEL=base-$VERSION-$BUILD-$(date +%Y%m%d-%H%M%S)
+ agent_amadan tokens create -label "$LABEL" | sed -n 's/^New token: //p' > "$TMP/pat"
+ [[ -s $TMP/pat ]] || die "could not read the new token"
+ PAT_ID=$(agent_amadan tokens list | awk -F'\t' -v l="$LABEL" '$2==l{print $1}')
+ [[ $PAT_ID == <-> ]] || die "no id for token $LABEL; revoke it by hand"
+ print -r -- '#!/bin/sh
+case "$1" in Username*) echo claude ;; *) cat "'"$TMP/pat"'" ;; esac' > "$TMP/askpass"; chmod 700 "$TMP/askpass"
+fi
+run agent_git git -C "$ARTIFACTS" pull -q --ff-only origin main
+run agent_git python3 "$TOOLS/publish_mac_update.py" "$RECORD" --config "$CONFIG" --repo "$ARTIFACTS" --sparkle-tools "$SPARKLE_BIN"
+run agent_git python3 "$TOOLS/publish_mac_update.py" "$RECORD" --config "$CONFIG" --repo "$ARTIFACTS" --sparkle-tools "$SPARKLE_BIN" --publish
+
+step "Done"
+say "feed: https://raw.amadan.net/oficina/native-releases/main/base/appcast.xml"
+[[ $PUBLISH == 1 ]] || say "nothing was built, signed or published: this was the plan"
diff --git a/native/scripts/testflight.sh b/native/scripts/testflight.sh
new file mode 100755
index 0000000..daad55c
--- /dev/null
+++ b/native/scripts/testflight.sh
@@ -0,0 +1,85 @@
+#!/bin/sh
+# Base for the iPhone, to TestFlight: an archive of this checkout's commit,
+# signed for the App Store with Base's profile, exported and uploaded with
+# the App Store Connect key. A copy of agent-tools/equipo-tf/testflight.sh
+# with Base's paths, bundle ID and profile, and no widget extension.
+#
+# native/scripts/testflight.sh VERSION BUILD # the plan
+# native/scripts/testflight.sh VERSION BUILD --upload # do it
+#
+# The plan (the default) checks what it can without signing (a clean tree
+# at a pushed commit, the pinned Timeless Sans, xcodegen) and prints every
+# command. --upload runs them in a detached worktree of the commit: the
+# Apple Distribution identity, Base's App Store profile (PROFILE, by name)
+# and the App Store Connect record "Oficina Base" (Paul's portal steps)
+# must exist. The worktree goes when it's done.
+set -eu
+VERSION=${1:?usage: testflight.sh VERSION BUILD [--upload]}
+BUILD=${2:?usage: testflight.sh VERSION BUILD [--upload]}
+UPLOAD=0
+case "${3:-}" in --upload) UPLOAD=1 ;; "") ;; *) echo "usage: testflight.sh VERSION BUILD [--upload]" >&2; exit 2 ;; esac
+NATIVE=$(cd "$(dirname "$0")/.." && pwd)
+REPO=$(dirname "$NATIVE")
+COMMIT=$(git -C "$REPO" rev-parse HEAD)
+TEAM=9U4A84C4WK
+PROFILE=${PROFILE:-Oficina Base iOS App Store 2026-11-23}
+KEYS=$HOME/private_keys/oficina
+WT=$(dirname "$REPO")/base-tf-$BUILD
+OUT=${TMPDIR:-/tmp}/base-tf-build-$BUILD
+
+run() { echo " + $*"; [ "$UPLOAD" = 0 ] || "$@"; }
+die() { echo "error: $*" >&2; exit 1; }
+
+[ "$UPLOAD" = 1 ] && echo "uploading Base $VERSION ($BUILD) from $COMMIT" || echo "the plan for Base $VERSION ($BUILD) from $COMMIT; --upload runs it"
+case "$BUILD" in ''|*[!0-9]*) die "BUILD is not a positive integer" ;; esac
+if [ -n "$(git -C "$REPO" status --porcelain)" ]; then
+ [ "$UPLOAD" = 1 ] && die "$REPO has local changes" || echo " WARNING: local changes (--upload refuses them)"
+fi
+git -C "$REPO" branch -r --contains "$COMMIT" | grep -q . || {
+ [ "$UPLOAD" = 1 ] && die "$COMMIT is on no remote branch" || echo " WARNING: $COMMIT is on no remote branch (--upload refuses it)"; }
+"$REPO/hack/fonts.sh" check
+command -v xcodegen >/dev/null || die "no xcodegen"
+if [ "$UPLOAD" = 1 ]; then
+ CERT=$(shasum -a 1 < "$KEYS/distribution.cer" | cut -d' ' -f1 | tr a-f A-F)
+ [ -f "$KEYS/AuthKey_94GGSRG3FH.p8" ] || die "no App Store Connect key"
+else
+ CERT='<Apple Distribution certificate, from ~/private_keys/oficina/distribution.cer>'
+ echo " checked only with --upload: the distribution identity, the App Store Connect key, profile '$PROFILE'"
+fi
+
+cleanup() { [ "$UPLOAD" = 0 ] || git -C "$REPO" worktree remove --force "$WT" 2>/dev/null || true; }
+trap cleanup EXIT
+run git -C "$REPO" worktree add -q --detach "$WT" "$COMMIT"
+# The font is fetched, never committed: the worktree gets its own copy.
+run mkdir -p "$WT/internal/look/static/fonts/timeless/1.094"
+run cp "$REPO/internal/look/static/fonts/timeless/1.094/TimelessSansVF.woff2" "$WT/internal/look/static/fonts/timeless/1.094/"
+run "$WT/native/scripts/fonts-into-bundle.sh" --release
+run rm -rf "$OUT"
+run mkdir -p "$OUT"
+run xcodegen generate --quiet --spec "$WT/native/ios/project.yml"
+run xcodebuild archive -project "$WT/native/ios/BasePhone.xcodeproj" -scheme BasePhone -destination generic/platform=iOS \
+ -derivedDataPath "$OUT/derived" -archivePath "$OUT/BasePhone.xcarchive" \
+ DEVELOPMENT_TEAM=$TEAM MARKETING_VERSION="$VERSION" CURRENT_PROJECT_VERSION="$BUILD" CODE_SIGN_STYLE=Manual \
+ CODE_SIGN_IDENTITY="$CERT" "OFICINA_PROVISIONING_PROFILE=$PROFILE"
+if [ "$UPLOAD" = 1 ]; then
+ APP=$(ls -d "$OUT/BasePhone.xcarchive/Products/Applications/"*.app)
+ codesign --verify --deep --strict "$APP"
+ /usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" -c "Print :CFBundleVersion" -c "Print :ITSAppUsesNonExemptEncryption" "$APP/Info.plist"
+ ls "$APP"/BaseNative_BaseKit.bundle/Fonts/TimelessSansVF.woff2 >/dev/null || die "Timeless Sans is not in the app"
+ cat > "$OUT/ExportOptions.plist" <<PL
+<?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>teamID</key><string>$TEAM</string>
+<key>signingStyle</key><string>manual</string><key>signingCertificate</key><string>$CERT</string>
+<key>provisioningProfiles</key><dict><key>works.oficina.base</key><string>$PROFILE</string></dict>
+<key>destination</key><string>upload</string><key>manageAppVersionAndBuildNumber</key><false/>
+</dict></plist>
+PL
+else
+ echo " (checks the archive's signature, bundle ID, build, export compliance and Timeless Sans; writes ExportOptions.plist for works.oficina.base)"
+fi
+run xcodebuild -exportArchive -archivePath "$OUT/BasePhone.xcarchive" -exportPath "$OUT/export" -exportOptionsPlist "$OUT/ExportOptions.plist" \
+ -authenticationKeyPath "$KEYS/AuthKey_94GGSRG3FH.p8" -authenticationKeyID 94GGSRG3FH \
+ -authenticationKeyIssuerID 69a6de8e-080a-47e3-e053-5b8c7c11a4d1
+[ "$UPLOAD" = 1 ] && rm -rf "$OUT/derived" || echo "nothing was archived, signed or uploaded: this was the plan"