Merge branch 'native/menu-name-release' into main
Calls: shared PlainAppNameCommands, SUBundleName, and a works.oficina.calls Mac release script Pins rastrillo/native to main c989034; replaces Calls' local PlainNameCommands with RastrilloApple's PlainAppNameCommands(name: "Calls") (declared first; Quit still reaches applicationShouldTerminate, so a call is left first); Settings window titled Calls; bundle-mac.py writes SUBundleName so Sparkle's windows say Calls; new native/scripts/release-mac.sh builds, signs, notarises and checks a works.oficina.calls release without publishing. Reviewed by the lander (diff read; same shape Fable approved for the shared fix and Calls' original). make ci, make native-mac, swift test (625/0) green; hub CI passed. Dry run 0.5.0 (31) notarised and launches.
6 files changed,
+303
−43
native/README.md+66 −8native/apple/Package.resolved+1 −1native/apple/Package.swift+7 −2native/apple/Sources/CallsMac/CallsMac.swift+10 −31native/scripts/bundle-mac.py+8 −1native/scripts/release-mac.sh+211 −0
CI passed — run details
CI log
=== vet === go vet ./... === fmt === === test === go test ./... ok amadan.net/oficina/calls/callscore (cached) ok amadan.net/oficina/calls/cmd/calls (cached) ? amadan.net/oficina/calls/cmd/calls-contract [no test files] ok amadan.net/oficina/calls/cmd/quality-summary (cached) ok amadan.net/oficina/calls/internal/calls 12.991s ok amadan.net/oficina/calls/internal/calls/apns (cached) ok amadan.net/oficina/calls/internal/calls/hub (cached) ? amadan.net/oficina/calls/internal/calls/icons [no test files] ? amadan.net/oficina/calls/internal/calls/keymailtest [no test files] ok amadan.net/oficina/calls/internal/calls/relay (cached) ok amadan.net/oficina/calls/internal/calls/seal (cached) ? amadan.net/oficina/calls/internal/calls/teamstate [no test files] ok amadan.net/oficina/calls/internal/callstest 12.453s ok amadan.net/oficina/calls/protocol (cached) ? amadan.net/oficina/calls/scripts/writeestilo [no test files] === migration-check === go run amadan.net/rastrillo/rastrillo/cmd/rastrillo migration check rastrillo migration check: models and migrations agree === race === CGO_ENABLED=1 go test -race ./internal/... ok amadan.net/oficina/calls/internal/calls 90.403s ok amadan.net/oficina/calls/internal/calls/apns (cached) ok amadan.net/oficina/calls/internal/calls/hub (cached) ? amadan.net/oficina/calls/internal/calls/icons [no test files] ? amadan.net/oficina/calls/internal/calls/keymailtest [no test files] ok amadan.net/oficina/calls/internal/calls/relay (cached) ok amadan.net/oficina/calls/internal/calls/seal (cached) ? amadan.net/oficina/calls/internal/calls/teamstate [no test files] ok amadan.net/oficina/calls/internal/callstest 48.636s
diff --git a/native/README.md b/native/README.md| index 29b7a23..33f9deb 100644 |
| --- a/native/README.md |
| +++ b/native/README.md |
| @@ -706,7 +706,9 @@ The production handoff endpoints were deployed in `86ed9f3`. In-progress handoff |
| server restart. There are at most 256 pending handoffs per server process. |
| `make native-mac` builds for the host Mac and signs the local `.app` ad hoc. |
| -Developer ID signing, notarization and App Store packaging remain follow-up work. |
| +Developer ID signing and notarization are `scripts/release-mac.sh` (see |
| +[Releasing the Mac app](#releasing-the-mac-app)); App Store packaging remains |
| +follow-up work. |
| The iPhone target, device builds and Safari tests are described in |
| [ios/README.md](ios/README.md). |
| @@ -740,13 +742,69 @@ be reinstalled by hand, once: |
| - the old "Calls" rows in System Settings ▸ Privacy & Security (Camera, |
| Microphone, Screen Recording). |
| -**For the next release.** The release archive is now named |
| -`works.oficina.calls-<build>.zip` (release_mac.py names it after the bundle |
| -ID). The app to package is `native/build/Oficina Calls.app`. The last release |
| -script, `/Users/paulcampbell/amadan.net/oficina/release-calls-0.4.16.sh` |
| -(outside this repository), hard-codes the old IDs (`BUNDLE_ID`, |
| -`IOS_BUNDLE_ID`, lines 36-37) and `build/Calls.app` (lines 211-257). Don't |
| -copy it unchanged for the next release. |
| +**For the next release.** Use `scripts/release-mac.sh` (below). The archive |
| +is now `works.oficina.calls-<build>.zip` (release_mac.py names it after the |
| +bundle ID), holding `Oficina Calls.app`. The old release scripts outside this |
| +repository (`/Users/paulcampbell/amadan.net/oficina/release-calls-0.4.16.sh` |
| +and its predecessors) hard-code `net.amadan.oficina.calls`, the `.ios` ID and |
| +`build/Calls.app`; don't use them again. |
| + |
| +## Releasing the Mac app |
| + |
| +`native/scripts/release-mac.sh <version> <build>` does everything up to |
| +publication and publishes nothing: |
| + |
| +1. **Preflight**: a clean tree; `mac-updates.json` is `works.oficina.calls`; |
| + rastrillo/native's tools are the checkout Package.resolved pins |
| + (`apple/.build/checkouts/native/tools`), not a separate copy; the build is |
| + above every build in the live feed (the publisher refuses anything else). |
| +2. **Keychain**: the Developer ID identity (default `Developer ID |
| + Application: Team Tito Limited (9U4A84C4WK)`), the Sparkle EdDSA key |
| + (account from `mac-updates.json`) matching `public_ed_key`, and the |
| + notarytool profile (default `slopbox-notary`). |
| +3. **Build**: `build-mac.sh` in the release configuration with the update |
| + configuration, version and build (`OFICINA_SKIP_PREPARE=1` reuses |
| + `native/build`'s CallsBridge, RNNoise and DeepFilter). |
| +4. **`release_mac.py`**: signs inside out with the hardened runtime, submits |
| + to the notary service and waits, staples, asks Gatekeeper, zips and signs |
| + the archive for Sparkle, and writes `release.json` beside it in the record |
| + directory (default |
| + `~/amadan.net/oficina/sparkle-worktrees/releases/calls-<version>-<build>`). |
| + The only entitlements are the camera and audio input the usage strings ask |
| + for; Calls declares no `entitlements` or `provisioning_profile` in |
| + `mac-updates.json` yet (Oficina ID's shared keychain is a later slice). |
| +5. **Smoke test**: the zip unpacked as a quarantined download is "Oficina |
| + Calls.app" with the ID, display name "Oficina Calls", CFBundleName and |
| + SUBundleName "Calls", the asset-catalog icon and RastrilloApple's resources; |
| + it has a stapled ticket, Gatekeeper accepts it as Notarized Developer ID, |
| + and it stays up 20 s launched translocated. |
| +6. **The publisher's plan**: `publish_mac_update.py` without `--publish`, |
| + against the `oficina/native-releases` clone (default |
| + `~/amadan.net/oficina/sparkle-worktrees/native-releases`, clean, on main). |
| + It checks the archive's metadata and signature and the build number, and |
| + prints the tag, download URL and feed, changing nothing. |
| + |
| +A record directory holding this build's finished release is reused, so a rerun |
| +after a failure in step 5 or 6 does not notarise again. |
| + |
| +**Publishing** is the one remaining command, which the script prints: |
| + |
| +```sh |
| +python3 native/apple/.build/checkouts/native/tools/publish_mac_update.py \ |
| + <record> --config native/mac-updates.json \ |
| + --repo ~/amadan.net/oficina/sparkle-worktrees/native-releases \ |
| + --sparkle-tools native/apple/.build/artifacts/sparkle/Sparkle/bin --publish |
| +``` |
| + |
| +It pushes the tag `calls-<build>` to `oficina/native-releases`, uploads the zip |
| +with `amadan release create`, checks the anonymous download against |
| +`release.json`, and only then commits and pushes `calls/appcast.xml`. Run it |
| +as the agent: `AMADAN_HOME=~/.amadan-claude-agent` for `amadan`, and git |
| +pushing with a temporary PAT from `amadan tokens create` (through |
| +`GIT_ASKPASS`, with `credential.helper` reset), revoked afterwards, as the |
| +0.4.x release scripts did. Rerunning it is the recovery. Then check the live |
| +feed's newest item, and reinstall by hand once (above): no installed Calls |
| +before this release can take it as an update. |
| ## Quality reports and Report a problem |
diff --git a/native/apple/Package.resolved b/native/apple/Package.resolved| index 07c9ad7..4d6b4cb 100644 |
| --- a/native/apple/Package.resolved |
| +++ b/native/apple/Package.resolved |
| @@ -5,7 +5,7 @@ |
| "kind" : "remoteSourceControl", |
| "location" : "https://amadan.net/rastrillo/native", |
| "state" : { |
| - "revision" : "b6a4067e39efd641fd5fa149cc666fee47bdb9b5" |
| + "revision" : "c989034602fd540531e845b0934864575be11b3e" |
| } |
| }, |
| { |
diff --git a/native/apple/Package.swift b/native/apple/Package.swift| index 9d866a3..dda20be 100644 |
| --- a/native/apple/Package.swift |
| +++ b/native/apple/Package.swift |
| @@ -3,7 +3,7 @@ import PackageDescription |
| import Foundation |
| let sharedNative: Package.Dependency = ProcessInfo.processInfo.environment["OFICINA_NATIVE_PACKAGE_PATH"].map { .package(path: $0) } |
| - ?? .package(url: "https://amadan.net/rastrillo/native", revision: "b6a4067e39efd641fd5fa149cc666fee47bdb9b5") |
| + ?? .package(url: "https://amadan.net/rastrillo/native", revision: "c989034602fd540531e845b0934864575be11b3e") |
| let package = Package( |
| name: "CallsNative", |
| @@ -35,7 +35,12 @@ let package = Package( |
| .target(name: "DeepFilter", condition: .when(platforms: [.macOS])), |
| .product(name: "LiveKitWebRTC", package: "webrtc-xcframework"), |
| ]), |
| - .executableTarget(name: "CallsMac", dependencies: [.product(name: "RastrilloMacUpdates", package: "native", condition: .when(platforms: [.macOS])), "CallsKit"], resources: [.copy("Resources/AppIcon.png"), .copy("Resources/MacIcon.png")]), |
| + // RastrilloApple for PlainAppNameCommands (the app menu's plain name) only; |
| + // Calls' sign-in and session store are still its own (CallsKit). |
| + .executableTarget(name: "CallsMac", dependencies: [ |
| + .product(name: "RastrilloMacUpdates", package: "native", condition: .when(platforms: [.macOS])), |
| + .product(name: "RastrilloApple", package: "native", condition: .when(platforms: [.macOS])), |
| + "CallsKit"], resources: [.copy("Resources/AppIcon.png"), .copy("Resources/MacIcon.png")]), |
| .executableTarget(name: "CallsInterop", dependencies: ["CallsKit"]), |
| .testTarget(name: "CallsKitTests", dependencies: ["CallsKit", "CallsBroadcastKit"], resources: [.copy("Fixtures")]), |
| ] |
diff --git a/native/apple/Sources/CallsMac/CallsMac.swift b/native/apple/Sources/CallsMac/CallsMac.swift| index fa4a4a6..bb845e5 100644 |
| --- a/native/apple/Sources/CallsMac/CallsMac.swift |
| +++ b/native/apple/Sources/CallsMac/CallsMac.swift |
| @@ -1,4 +1,5 @@ |
| #if os(macOS) |
| +import RastrilloApple |
| import RastrilloMacUpdates |
| #endif |
| import AppKit |
| @@ -30,8 +31,13 @@ import LiveKitWebRTC |
| } |
| .defaultSize(width: 1000, height: 760) |
| .commands { |
| + // First, so that Check for Updates (after About) survives the groups it |
| + // replaces. About, Hide, Quit and Help say "Calls", not the display name |
| + // "Oficina Calls" SwiftUI would use. Quit is NSApp.terminate, so it still |
| + // reaches applicationShouldTerminate below and a call is left first. The |
| + // name is passed, not read from CFBundleName, so `swift run` says Calls too. |
| + PlainAppNameCommands(name: "Calls") |
| CommandGroup(replacing: .newItem) {} |
| - PlainNameCommands() |
| NativeUpdateCommands(updater: updater) |
| CommandMenu("Call") { CallMenuItems(model: model) } |
| } |
| @@ -41,6 +47,9 @@ import LiveKitWebRTC |
| automaticUpdates: updater.canInstallUpdatesAutomatically |
| ? Binding(get: { updater.automaticallyInstallsUpdates }, set: { updater.automaticallyInstallsUpdates = $0 }) |
| : nil) |
| + // SwiftUI titles a Settings window without tabs from the display |
| + // name ("Oficina Calls Settings"); inside the app it is plain Calls. |
| + .navigationTitle("Calls") |
| } |
| } |
| } |
| @@ -109,36 +118,6 @@ final class CallsAppDelegate: NSObject, NSApplicationDelegate { |
| } |
| } |
| -/// The application menu's own items, under the name the app has inside its |
| -/// windows. Finder, the Dock and Spotlight say "Oficina Calls" (the bundle's |
| -/// file name and CFBundleDisplayName), but SwiftUI builds About, Hide, Quit |
| -/// and Help from CFBundleDisplayName too, which would put "Quit Oficina |
| -/// Calls" in a menu headed by the plain name. These are the same actions |
| -/// AppKit's own items take, with the same shortcuts: Quit still goes |
| -/// through applicationShouldTerminate, so a call is left first. |
| -struct PlainNameCommands: Commands { |
| - static let name = "Calls" |
| - |
| - var body: some Commands { |
| - CommandGroup(replacing: .appInfo) { |
| - // The standard panel names the app by CFBundleName, which is "Calls". |
| - Button("About \(Self.name)") { NSApp.orderFrontStandardAboutPanel(nil) } |
| - } |
| - CommandGroup(replacing: .appVisibility) { |
| - Button("Hide \(Self.name)") { NSApp.hide(nil) }.keyboardShortcut("h") |
| - Button("Hide Others") { NSApp.hideOtherApplications(nil) } |
| - .keyboardShortcut("h", modifiers: [.command, .option]) |
| - Button("Show All") { NSApp.unhideAllApplications(nil) } |
| - } |
| - CommandGroup(replacing: .appTermination) { |
| - Button("Quit \(Self.name)") { NSApp.terminate(nil) }.keyboardShortcut("q") |
| - } |
| - CommandGroup(replacing: .help) { |
| - Button("\(Self.name) Help") { NSApp.showHelp(nil) }.keyboardShortcut("?") |
| - } |
| - } |
| -} |
| - |
| /// The Call menu. Mute is here so that its shortcut can be found, and so |
| /// that there is one when Space belongs to a text field or a button. Copy |
| /// Invite Link puts the meeting's link on the clipboard without the share |
diff --git a/native/scripts/bundle-mac.py b/native/scripts/bundle-mac.py| index 4fe135d..6475ff8 100644 |
| --- a/native/scripts/bundle-mac.py |
| +++ b/native/scripts/bundle-mac.py |
| @@ -26,7 +26,8 @@ products = Path(subprocess.check_output(['swift', 'build', '--package-path', str |
| # CFBundleDisplayName), apart from every other calls app. Inside its own |
| # windows the app is plain "Calls": CFBundleName is the short name the menu bar |
| # and the About panel use. (SwiftUI titles About, Hide, Quit and Help with the |
| -# display name, so CallsMac.swift's PlainNameCommands names them itself.) Same |
| +# display name, so CallsMac.swift declares RastrilloApple's |
| +# PlainAppNameCommands to name them itself.) Same |
| # rule as rastrillo/native tools/bundle-mac.py. |
| display_name = 'Oficina Calls' |
| bundle = root / f'build/{display_name}.app/Contents' |
| @@ -99,6 +100,12 @@ info = { |
| 'CFBundleURLTypes': [{'CFBundleURLName': updates['bundle_id'], |
| 'CFBundleURLSchemes': updates['url_schemes']}], |
| 'CFBundleName': 'Calls', 'CFBundleDisplayName': display_name, |
| + # Sparkle names the app from SUBundleName, then CFBundleDisplayName |
| + # (SUHost.m), so without this its windows would say "Oficina Calls is now |
| + # updated" in an app whose menu is Calls. Its installer still finds the |
| + # update by file name or bundle ID first (SUInstaller.m), so the plain name |
| + # changes no lookup. As rastrillo/native tools/bundle-mac.py writes it. |
| + 'SUBundleName': 'Calls', |
| # Paul, 2026-11-14: every Oficina build, Sparkle and App Store, Mac and |
| # iPhone, is works.oficina.<app>: here works.oficina.calls, read from |
| # mac-updates.json so the two cannot disagree (mac_updates.py refuses a |
diff --git a/native/scripts/release-mac.sh b/native/scripts/release-mac.sh| new file mode 100755 |
| index 0000000..ecf2fbc |
| --- /dev/null |
| +++ b/native/scripts/release-mac.sh |
| @@ -0,0 +1,211 @@ |
| +#!/bin/zsh |
| +# A Calls Mac release, up to but not including publication: "Oficina Calls.app" |
| +# as works.oficina.calls, Developer ID signed inside out, notarised, stapled, |
| +# checked by Gatekeeper as a quarantined download, launched, and validated |
| +# against the feed by the publisher's own read-only plan. |
| +# |
| +# native/scripts/release-mac.sh <version> <build> |
| +# native/scripts/release-mac.sh 0.5.0 31 |
| +# |
| +# It publishes nothing: no tag, no release asset, no appcast commit. The last |
| +# thing it prints is the publish command, for whoever publishes (see "Releasing |
| +# the Mac app" in native/README.md). |
| +# |
| +# Everything Calls-specific is read from the repository, not written here: the |
| +# bundle ID, feed and Sparkle key from native/mac-updates.json, the app's file |
| +# name from what scripts/bundle-mac.py built, and rastrillo/native's release |
| +# tools from the revision Package.resolved pins (apple/.build/checkouts/native). |
| +# So it cannot drift from the app the way release-calls-0.4.16.sh (outside the |
| +# repository, net.amadan.oficina.calls and build/Calls.app hard-coded) did. |
| +# |
| +# Environment: |
| +# IDENTITY Developer ID identity (default Team Tito Limited's) |
| +# TEAM its Team ID (default 9U4A84C4WK) |
| +# NOTARY_PROFILE notarytool keychain profile (default slopbox-notary) |
| +# RECORD release directory (default |
| +# ~/amadan.net/oficina/sparkle-worktrees/releases/calls-<version>-<build>); |
| +# it must not exist, unless it holds this build's finished |
| +# release, which is then checked and reused |
| +# ARTIFACTS the oficina/native-releases clone the plan is checked |
| +# against (default ~/amadan.net/oficina/sparkle-worktrees/native-releases); |
| +# unset or missing skips the plan with a warning |
| +# OFICINA_SKIP_PREPARE=1 reuse native/build's CallsBridge, RNNoise and |
| +# DeepFilter instead of rebuilding them (build-mac.sh) |
| +# ALLOW_DIRTY=1 build from a tree with local changes (a rehearsal only: |
| +# the release records the commit, which then does not name it) |
| + |
| +set -e -u -o pipefail |
| +setopt no_nomatch |
| + |
| +VERSION=${1:?usage: release-mac.sh <version> <build>} |
| +BUILD=${2:?usage: release-mac.sh <version> <build>} |
| +[[ $VERSION =~ '^[0-9]+(\.[0-9]+){0,2}$' ]] || { print -u2 "version must be numeric, like 0.5.0"; exit 2 } |
| +[[ $BUILD =~ '^[1-9][0-9]*$' ]] || { print -u2 "build must be a positive integer"; exit 2 } |
| + |
| +IDENTITY=${IDENTITY:-'Developer ID Application: Team Tito Limited (9U4A84C4WK)'} |
| +TEAM=${TEAM:-9U4A84C4WK} |
| +NOTARY_PROFILE=${NOTARY_PROFILE:-slopbox-notary} |
| + |
| +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 |
| +RECORD=${RECORD:-$HOME/amadan.net/oficina/sparkle-worktrees/releases/calls-$VERSION-$BUILD} |
| +ARTIFACTS=${ARTIFACTS-$HOME/amadan.net/oficina/sparkle-worktrees/native-releases} |
| + |
| +json() { python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))[sys.argv[2]])' "$@" } |
| +BUNDLE_ID=$(json "$CONFIG" bundle_id) |
| +FEED_URL=$(json "$CONFIG" feed_url) |
| +ZIP=$BUNDLE_ID-$BUILD.zip |
| + |
| +typeset -a NOTES |
| +STEP=0 |
| +SMOKE_PID="" |
| +TMP=$(mktemp -d "${TMPDIR:-/tmp}/calls-release.XXXXXX") |
| +step() { STEP=$((STEP + 1)); print -P "\n%B%F{cyan}==> [$STEP/6] $*%f%b" } |
| +say() { print -r -- " $*" } |
| +ok() { print -n -P " %F{green}ok%f "; print -r -- "$*" } |
| +warn() { print -n -P " %F{yellow}warning:%f "; print -r -- "$*"; NOTES+=("$*") } |
| +die() { print -n -P "%F{red}error:%f " >&2; print -r -- "$*" >&2; exit 1 } |
| +need() { [[ -e $1 ]] || die "missing: $1" } |
| +plist() { plutil -extract "$2" raw -o - "$1/Contents/Info.plist" } |
| +on_exit() { |
| + local rc=$? |
| + [[ -n $SMOKE_PID ]] && kill "$SMOKE_PID" 2>/dev/null || true |
| + rm -rf "$TMP" |
| + (( rc == 0 )) || print -P "\n%F{red}%BFAILED%b at step $STEP, exit $rc. Nothing was published.%f" >&2 |
| +} |
| +trap on_exit EXIT |
| +trap 'exit 130' INT TERM |
| + |
| +COMMIT=$(git -C "$REPO" rev-parse HEAD) |
| +print -P "%BOficina Calls $VERSION ($BUILD), $BUNDLE_ID%b, commit ${COMMIT[1,12]}" |
| + |
| +# ---- 1. Preflight (read-only) --------------------------------------------- |
| +step "Preflight: tree, tools, feed" |
| +if [[ -n $(git -C "$REPO" status --porcelain --untracked-files=no) ]]; then |
| + [[ ${ALLOW_DIRTY:-0} == 1 ]] || die "the tree has local changes; commit them (or ALLOW_DIRTY=1 for a rehearsal)" |
| + warn "built from a tree with local changes: $COMMIT does not name this build" |
| +fi |
| +[[ $BUNDLE_ID == works.oficina.calls ]] || die "mac-updates.json says $BUNDLE_ID, not works.oficina.calls" |
| +for tool in python3 curl shasum ditto xcrun spctl codesign; do command -v $tool >/dev/null || die "$tool not on PATH"; done |
| +# The pinned tools exist only after SwiftPM has resolved the package once. |
| +[[ -d $TOOLS ]] || swift package --package-path "$NATIVE/apple" resolve |
| +for file in "$TOOLS/release_mac.py" "$TOOLS/publish_mac_update.py" "$SPARKLE_BIN/sign_update" "$SPARKLE_BIN/generate_keys" "$SPARKLE_BIN/generate_appcast"; do need "$file"; done |
| +pinned=$(python3 -c 'import json,sys; print(next(p["state"]["revision"] for p in json.load(open(sys.argv[1]))["pins"] if p["identity"] == "native"))' "$NATIVE/apple/Package.resolved") |
| +checkout=$(git -C "$TOOLS/.." rev-parse HEAD) |
| +[[ $checkout == $pinned ]] || die "rastrillo/native checkout is ${checkout[1,7]}, Package.resolved pins ${pinned[1,7]}; run swift package resolve" |
| +ok "rastrillo/native tools at the pin, ${pinned[1,7]}" |
| +# The publisher refuses a build at or below any published one; say so now, |
| +# before twenty minutes of building and notarising. |
| +curl -fsS "$FEED_URL" -o "$TMP/feed.xml" || die "could not fetch $FEED_URL" |
| +newest=$(python3 - "$TMP/feed.xml" <<'PY' |
| +import sys, xml.etree.ElementTree as ET |
| +S = '{http://www.andymatuschak.org/xml-namespaces/sparkle}' |
| +print(max([int(v.text) for v in ET.parse(sys.argv[1]).iter(S + 'version')] or [0])) |
| +PY |
| +) |
| +(( BUILD > newest )) || die "the feed already has build $newest; this build must be above it" |
| +ok "feed's newest build is $newest; $BUILD is above it" |
| + |
| +# ---- 2. Keychain (read-only) ------------------------------------------------ |
| +step "Keychain: Developer ID, Sparkle key, notary profile" |
| +[[ $(security find-identity -v -p codesigning) == *"\"$IDENTITY\""* ]] || die "no valid '$IDENTITY' identity" |
| +ok "$IDENTITY" |
| +key=$("$SPARKLE_BIN/generate_keys" --account "$(json "$CONFIG" keychain_account)" -p) |
| +[[ $key == $(json "$CONFIG" public_ed_key) ]] || die "the Sparkle key in the keychain is not mac-updates.json's public_ed_key" |
| +ok "Sparkle EdDSA key matches mac-updates.json" |
| +xcrun notarytool history --keychain-profile "$NOTARY_PROFILE" >/dev/null || die "notary profile $NOTARY_PROFILE did not authenticate" |
| +ok "notary profile $NOTARY_PROFILE authenticates" |
| + |
| +# ---- 3. Build --------------------------------------------------------------- |
| +REUSE=0 |
| +if [[ -e $RECORD ]]; then |
| + [[ -f $RECORD/release.json && -f $RECORD/$ZIP ]] || die "$RECORD exists without release.json and $ZIP; inspect and remove it" |
| + [[ $(json "$RECORD/release.json" version) == $VERSION && $(json "$RECORD/release.json" build) == $BUILD ]] || die "$RECORD is another release" |
| + REUSE=1 |
| +fi |
| +step "Build Oficina Calls.app $VERSION ($BUILD), release configuration" |
| +APP=$NATIVE/build/Oficina\ Calls.app |
| +if (( REUSE )); then |
| + say "skipped: reusing the notarised release in ${RECORD/#$HOME/~}" |
| +else |
| + (cd "$NATIVE" && OFICINA_BUILD_CONFIGURATION=release scripts/build-mac.sh \ |
| + --updates-config mac-updates.json --version "$VERSION" --build "$BUILD" --sign-identity "$IDENTITY") |
| + [[ $(plist "$APP" CFBundleIdentifier) == $BUNDLE_ID ]] || die "built app is not $BUNDLE_ID" |
| + [[ $(plist "$APP" CFBundleShortVersionString) == $VERSION && $(plist "$APP" CFBundleVersion) == $BUILD ]] || die "built app is not $VERSION ($BUILD)" |
| + ok "${APP/#$HOME/~} is $BUNDLE_ID $VERSION ($BUILD)" |
| +fi |
| + |
| +# ---- 4. Sign, notarise, staple, EdDSA (release_mac.py) ------------------------- |
| +step "release_mac.py: sign inside out, notarise, staple, Gatekeeper, Sparkle archive" |
| +if (( ! REUSE )); then |
| + say "notarisation usually takes a few minutes" |
| + python3 "$TOOLS/release_mac.py" "$APP" --config "$CONFIG" --sparkle-tools "$SPARKLE_BIN" \ |
| + --identity "$IDENTITY" --team "$TEAM" --notary-profile "$NOTARY_PROFILE" --output "$RECORD" |
| +fi |
| +SHA=$(json "$RECORD/release.json" sha256); LEN=$(json "$RECORD/release.json" length) |
| +[[ $(shasum -a 256 "$RECORD/$ZIP" | cut -d' ' -f1) == $SHA ]] || die "$ZIP's digest differs from release.json" |
| +ok "$ZIP: $LEN bytes, sha256 $SHA, notarisation $(json "$RECORD/release.json" notarization_id)" |
| +say "entitlements: $(python3 -c 'import json,sys; print(", ".join(sorted(json.load(open(sys.argv[1]))["entitlements"])))' "$RECORD/release.json")" |
| + |
| +# ---- 5. The download, as a person gets it ---------------------------------------- |
| +step "Smoke test: quarantined copy, names, Gatekeeper, translocated launch for 20 s" |
| +SMOKE=$TMP/smoke |
| +mkdir -p "$SMOKE" |
| +ditto -x -k "$RECORD/$ZIP" "$SMOKE" |
| +apps=("$SMOKE"/*.app(N)) |
| +(( ${#apps} == 1 )) || die "the archive holds ${#apps} apps, not one" |
| +GOT=${apps[1]} |
| +[[ ${GOT:t} == "Oficina Calls.app" ]] || die "the archive holds ${GOT:t}, not Oficina Calls.app" |
| +for pair in CFBundleIdentifier=$BUNDLE_ID CFBundleDisplayName="Oficina Calls" CFBundleName=Calls SUBundleName=Calls CFBundleIconName=AppIcon; do |
| + [[ $(plist "$GOT" ${pair%%=*}) == ${pair#*=} ]] || die "${pair%%=*} is '$(plist "$GOT" ${pair%%=*})', not '${pair#*=}'" |
| +done |
| +ok "Oficina Calls.app: $BUNDLE_ID, display name Oficina Calls, CFBundleName and SUBundleName Calls" |
| +[[ -f $GOT/Contents/Resources/Assets.car ]] || die "no Assets.car" |
| +[[ -d $GOT/Contents/Resources/RastrilloNative_RastrilloApple.bundle ]] || die "no RastrilloApple resources (the app menu's strings)" |
| +xattr -w com.apple.quarantine "0081;$(printf %x $(date +%s));Safari;" "$GOT" |
| +xcrun stapler validate "$GOT" >/dev/null || die "no stapled ticket" |
| +gk=$(spctl --assess --type execute -vv "$GOT" 2>&1) || die "Gatekeeper rejected the app: $gk" |
| +[[ $gk == *"source=Notarized Developer ID"* && $gk == *"origin=$IDENTITY"* ]] || die "unexpected Gatekeeper verdict: $gk" |
| +ok "Gatekeeper: accepted, Notarized Developer ID, $TEAM" |
| +say "launching; if macOS asks whether to open an app downloaded from the Internet, click Open" |
| +open -n "$GOT" |
| +for _ in {1..60}; do |
| + SMOKE_PID=$(pgrep -f 'AppTranslocation/.*/Oficina Calls\.app/Contents/MacOS/CallsMac' | head -1 || true) |
| + [[ -n $SMOKE_PID ]] && break |
| + sleep 1 |
| +done |
| +[[ -n $SMOKE_PID ]] || die "the translocated app did not start within 60 s" |
| +sleep 20 |
| +kill -0 "$SMOKE_PID" 2>/dev/null || die "the app quit within 20 s of launch" |
| +ok "ran translocated for 20 s (pid $SMOKE_PID)" |
| +kill "$SMOKE_PID" 2>/dev/null || true |
| +SMOKE_PID="" |
| + |
| +# ---- 6. The publisher's plan (read-only) ------------------------------------------ |
| +step "publish_mac_update.py plan (validates; changes nothing)" |
| +if [[ -n $ARTIFACTS && -d $ARTIFACTS/.git ]]; then |
| + python3 "$TOOLS/publish_mac_update.py" "$RECORD" --config "$CONFIG" --repo "$ARTIFACTS" --sparkle-tools "$SPARKLE_BIN" |
| +else |
| + warn "no native-releases clone at '${ARTIFACTS:-unset}'; the publisher's plan was not checked" |
| +fi |
| + |
| +cat <<EOF |
| + |
| +----- Oficina Calls $VERSION ($BUILD): ready to publish, NOT published ----- |
| +commit: $COMMIT |
| +release: $RECORD |
| +archive: $ZIP $LEN bytes sha256 $SHA |
| +feed: $FEED_URL (newest now $newest) |
| +notes: ${(j:; :)NOTES:-none} |
| + |
| +Publish (pushes tag calls-$BUILD, uploads the zip, commits the appcast), with |
| +git and amadan as the agent (native/README.md, "Releasing the Mac app"): |
| + python3 $TOOLS/publish_mac_update.py \\ |
| + $RECORD \\ |
| + --config $CONFIG --repo ${ARTIFACTS:-<native-releases clone>} \\ |
| + --sparkle-tools $SPARKLE_BIN --publish |
| +------------------------------------------------------------------------ |
| +EOF |