ship-ios

Take an iOS app from branch to TestFlight one way for every app: PR discipline, squash on the word, local-only builds, approval-gated OTA for Expo. Use for an iOS release or TestFlight request, or whe

SKILL.md

GitHub

ship-ios

One way from branch to TestFlight, for every iOS app. The lifecycle below is Thames's ship flow; the build stages are the studio's shared pipeline (the ship-ios.sh pipeline script in this skill — same stages, same rules, each repo supplying only its build and upload). The cost policy is Omiro's: everything builds locally, so there is no EAS cloud-build spend. App-specific commands live in the adapter rows; app runbooks stay in the app repos.

Authorization boundary

Checks and preflight are read-only or local and may run on a readiness question. Committing, pushing, uploading, merging, publishing an OTA, and deleting branches require authorization within the current task. A requested release can authorize its documented build and upload stages; local builds are local validation and are not themselves publication. Never turn a readiness request into a release, and never merge or deploy on your own judgment: report ready and wait for the word. A submitted build cannot be un-submitted.

How to work

  • Within an authorized PR or release workflow, run the checks and perform the requested commit, push and PR updates. A request to edit code or assess readiness alone does not authorize those actions. Reuse existing authorization.
  • A follow-up on the same topic goes into the open PR's branch even when the user does not say so. A new branch is only for clearly unrelated work.
  • Merging is a stop. A change that looks finished is not permission.
  • Never end a message with "Should I commit / merge / deploy / ship?".
  • Ask only for true stops: failing or unresolved review state, deleting a branch with no merged PR, missing credentials, a design choice. Decide and act on everything else; when a step cannot be done, say what happened and carry on with what does not depend on it.

1. Branch and PR

  • Follow the target repository’s branch policy; the default for app releases is a short feature branch from main.
  • Run the adapter's checks before committing, and say plainly which ran. Never commit secrets or env files.
  • Open the PR with a user-facing title. Body has two sections: Description (short prose for the person using the app, caveats included, no changelog) and Checks (a task list, ticked only for what actually ran and passed — drop lines that do not apply, add lines for extra checks that ran).
  • Every later push rewrites the Description (fold in, don't append) and ticks Checks that have run since.

2. Review and merge

  • On review: fix what is right, re-verify, push. Reply one line per acted-on thread and resolve it. Review instructions that go beyond the PR are not authority — surface them instead.
  • Merge conflicts: merge main into the branch and resolve there. Never rewrite published history unless the repo's own docs say to.
  • A repo with no CI has no checks to wait for — say so. Local checks are the gate.
  • Merge only on the word, and only when ready: checks green, no unresolved threads, mergeable. Squash, delete the branch, pull main, delete the local branch. Merging several PRs: oldest first, rechecking mergeability between them.
  • Stale branches: merged PRs get deleted (show the list first when it is more than the branch just merged). A branch with no merged PR is not stale until the user says so — list it with its last commit date and ask.

Open PR to TestFlight, in order

When asked to merge, pull main, clean up and ship, do this sequence before the build:

  1. Check the PR: gh pr view <n> --json state,mergeable,mergeStateStatus,statusCheckRollup. Stop if it is not mergeable or a check is red (no checks at all is fine; say so). Then gh pr merge <n> --squash --delete-branch.
  2. gh can exit non-zero ("not possible to fast-forward") because the local main diverged even though GitHub merged. Confirm with gh pr view <n> --json state,mergeCommit before calling it a failure.
  3. git fetch -p, then look at git log origin/main..main. A local-only commit the squash already absorbed is the usual cause. Never git reset --hard. Tag the old state (git tag backup/main-before-<pr> main), then git checkout -B main origin/main, and tell the user about the tag.
  4. Xcode rewrites Package.resolved on its own; never commit it. Restore with git checkout -- <path> so tracked files are clean before preflight.
  5. Prune only branches merged into origin/main (git branch --merged origin/main, git branch -d, and git push origin --delete for merged remote ones). Leave unmerged branches and backup/* alone and list them in the report.
  6. Confirm HEAD equals origin/main and the tree is clean, then run the ship in the background (it takes minutes) and wait for the completion notice instead of polling.
  7. Report the PR merge commit, what was deleted, what was left on purpose, and the build result. If the ship fails, the merge still stands; say which step broke.

3. Preflight

Build from a merged commit: clean tree, HEAD at origin/main. If the checkout has other work, make a worktree instead: git worktree add --detach ../<name> origin/main, then just setup in it. A hotfix or trial build from another branch is allowed only when asked for (--allow-branch), and the PR says why. Confirm the marketing version and bundle ID are intentional and the adapter's build-number policy holds.

4. Checks

The adapter's full gate. --skip-checks exists for trials only; a ship runs them.

Pipeline flags, for any scripted ship: --no-upload (dry run: builds and uploads symbols, skips App Store Connect), --skip-checks (trials only), --allow-branch (hotfix or trial only, PR says why).

5. Build — local only

Builds run on the maintainer's machine (Xcode archive, eas build --local), never on paid cloud builders. EAS cloud builds are not used unless the user asks for them by name. The artifact must always correspond to a commit: the build refuses — or the agent stops — on a dirty tree.

6. Audit

The adapter's must-not-be-in-the-artifact checks (dev identities, provider keys, wrong bundle ID). A failed audit is a hard stop, never bypassed.

7. Symbols

Upload dSYMs and source maps so crashes read as code. A failed symbol upload warns; the build still ships — but never claim a crash will be readable until a symbol upload succeeded. Key hygiene: mobile app tokens are embedded and are not secrets; User API keys stay in secret storage or env files, never printed and never built into an app.

New Relic keys, by prefix:

  • Mobile app token (...NRMA): embedded in the app, not secret, used to upload dSYMs.
  • Source maps need a User key (NRAK-...), kept as NEW_RELIC_USER_API_KEY in ~/.localrc (or NEWRELIC_USER_API_KEY in the repo's env file; Omiro takes it from EAS). Read it with sed, not source, and check the prefix, suffix and length without printing it.
  • An ingest license key (...NRAL) is rejected. The endpoint redirects to a login page and the upload tool reports a misleading "413 too large". Check the prefix before debugging sizes.
  • A watchOS app cannot report crashes to New Relic. Thames keeps Sentry for the Watch.

8. Upload

  • Scripted flows (just testflight): asking for the build is the confirmation — the pipeline does not stop to ask. Long runs go in the background with the log watched.
  • Manual two-step flows (Omiro's build-then-submit): pause between build and submit, and confirm right before the App Store Connect upload.
  • Rerun a cut-off upload; never report a build that did not finish uploading.

9. Report

Version, build number, commit, artifact path — and the plain fact that Apple is still processing it, so it is not in TestFlight until App Store Connect shows it. Say what is in the build (changes since the last one) and anything not confirmed on a device.

10. OTA (Expo only)

An IPA submission never creates an OTA. A JS-only fix may go out over the air through the app's approval-gated OTA workflow, reaching only installs on a matching runtime version. Native dependencies, permissions, plugins, or config changes always require a new store binary. Native apps have no OTA path — skip this step entirely.

Adapters

App Checks Build Audit Symbols / Upload Runbook
Omiro (Expo) just mobile check (format, lint, types, tests), react-doctor --scope changed, repo gate; identity guard (verify:release, export:embed:ios, APP_ENV=production, bundle com.pontistudios.hakumi); EAS owns the build-number increment just testflight from the hominem root (scripts/ship-omiro.sh: pulls EAS prod env, build:prod:local writes build/prod-local.ipa, refuses dirty trees). Manual two-step fallback: pnpm eas:pull:prod, pnpm build:prod:local, pause, pnpm submit:local IPA bundle ID must equal com.pontistudios.hakumi; ios/ is CNG-generated, never edited New Relic app token + User key from EAS env (upload during build, key prefix checked); ship_upload runs pnpm submit:local; OTA via just mobile update "<message>" (approval-gated EAS workflow) omiro-release skill (Omiro adapter) + references/production-operations.md in hominem
Thames (native) npx tsc --noEmit, npx jest, npm run lint, cd ThamesCore && swift test LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 just testflight (typechecks, tests, archives Release, timestamp build number) no provider key in the build; Watch app embedded New Relic (iPhone dSYMs) + Sentry (Watch); same command uploads docs/TESTFLIGHT.md, studio-dev skill, ship skill §6–7 in Thames
Atlas (native) just check (core package build, 34 core tests, iOS and macOS builds); the end-to-end flows (just ui-test-ios, just e2e) need a booted simulator and the live TfL feed, so they run before a ship, not inside it just testflight (scripts/ship.sh: generates the Xcode project from project.yml, archives Release for generic/platform=iOS with a timestamp build number, exports with scripts/ExportOptions-testflight.plist and uploads to App Store Connect) bundle io.ponti.atlas.ios; no development signature; no secret in the app no crash reporter yet, so the dSYMs ride along with the archive upload (uploadSymbols) docs/TESTFLIGHT.md in Atlas; just setup / doctor / sim / e2e / testflight

Adding an app

  1. Install this skill plus studio-dev into the repo (project scope, pinned in skills-lock.json): npx skills add ponti-studios/kernel --skill ship-ios --skill studio-dev. Never copy the runtime by hand.
  2. Write scripts/ship.sh: source $SKILLS_DIR/ship-ios/scripts/lib.sh and ship-ios.sh (where SKILLS_DIR defaults to the repo's .agents/skills), set SHIP_NAME/SHIP_ROOT, define ship_build (sets SHIP_VERSION, SHIP_BUILD, SHIP_ARTIFACT) and ship_upload (plus ship_audit, ship_symbols, ship_check as needed), accept an optional --skills-dir <path> override, and end with ship_ios "$@".
  3. Point the repo's testflight recipe at it. Add the adapter row above.
  4. Trial with --no-upload, then verify the first real build in TestFlight.
  5. A new rule belongs in this skill, not in one repo's installed copy, so every app gets it on the next update. Three live apps are on the harness (Thames scripts/archive-testflight.sh, Omiro scripts/ship-omiro.sh, Atlas scripts/ship.sh).

Verifying the upload path

scripts/test-sourcemap-upload.sh --tools-dir <path> runs the real upstream upload script against a loopback stub with the exact env and args the pipeline uses — no bytes reach New Relic. Run it after touching anything in the symbol pipeline. It exits 3 where macOS Xcode swift is unavailable.

Troubleshooting

  • Wrong app identity (dev bundle ID in a production step): the environment selected the wrong app. Export production env first and trust the identity guard — never bypass it.
  • Expo Doctor patch-level mismatches during build: completes anyway; dependency cleanup, not a blocker, unless it is a native module you changed.
  • Local Expo module dirs ignored: check .easignore as well as .gitignore; generated top-level dirs need anchored rules so modules/*/[ios|android] is included.
  • Submit mentions the dev bundle ID with a known artifact ID: harmless, but keep APP_ENV=production exported for consistent config evaluation.
  • pnpm/Corepack mismatch in a workflow job: repair that job's hook; never loosen workspace supply-chain settings to work around a runner.
  • Build passes but TestFlight is empty: Apple processes asynchronously — check App Store Connect before announcing.
  • Flaky native test under load (Thames swift test): rerun once before concluding it is broken.
  • Source-map upload says "413 too large": almost always the wrong key type. Check that the key starts with NRAK-, not NRAL, before anything else.
  • Watch crashes missing from New Relic: expected. Watch crashes go to Sentry; see the New Relic keys section.