Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

fix(ci): submit iOS only when the iPhone app changes

leepokaia053456a2e90
diff --git a/docs/guides/development.md b/docs/guides/development.md
index fa7f1495..cfaf002d 100644
--- a/docs/guides/development.md
+++ b/docs/guides/development.md
@@ -126,4 +126,4 @@ To bump, set `version` in `host/crates/memory/Cargo.toml` (patch for fixes, mino
## iOS releases (Xcode Cloud)
-The Xcode Cloud workflow "Release" on the product "iOS" has no automatic start condition (its own tag trigger never fired); it only runs when started through the API, and it archives the `iOS` scheme in Release with deployment preparation **TestFlight and App Store** (the "Internal Testing Only" option produces builds App Review can't take) and uploads it to App Store Connect. Xcode Cloud overrides the build number with its own counter (`CI_BUILD_NUMBER`, configured under Xcode Cloud settings → Build Number in App Store Connect), so `CURRENT_PROJECT_VERSION` in `project.yml` is only the local default. The checked-in `apps/Codync.xcodeproj` is what the cloud builds: regenerate it whenever `project.yml` changes, and commit `apps/Codync.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved` whenever a package version changes (Xcode Cloud never resolves packages itself; copy `apps/ios/Kit/Package.resolved` there if Xcode wrote it to `apps/ios/Kit/`). Xcode Cloud reads public package repositories without any connection. The `Submit iOS` GitHub workflow (`.github/workflows/ios-submit.yml` → `tools/asc-submit.py`, secrets `ASC_KEY_ID`, `ASC_ISSUER_ID`, `ASC_PRIVATE_KEY`) runs on every `v*` tag (the tags Auto Tag pushes after a version bump on `main`). It compares the tag with the last version sent to the App Store: when nothing the iPhone app is built from changed (`apps/ios/` including `apps/ios/Kit/`, `apps/shared/`, the package pins, or `apps/project.yml` beyond its version lines), iOS skips that release, so host- or desktop-only releases neither build nor touch a version in review. Otherwise it starts the Xcode Cloud archive on the tag, waits for that build to finish processing and submits it for App Review, released automatically after approval. The latest version wins: a version still *Waiting for Review* is pulled back, renamed and resubmitted with the new build; one already *In Review* or approved is left alone (rerun the workflow with the version once it is out). *What's New* comes from the version's `## <version>` section in `apps/ios/WhatsNew.md` (one `### <locale>` per App Store language, written in the version bump); without one, the `### zh-Hant` / `### en-US` bullets under `## What's New` in the PR template are collected from every PR merged since the last App Store version (changes pushed to `main` without a PR add nothing); with neither, empty fields get a generic "Bug fixes and improvements" line. Running `Submit iOS` by hand with a version ships it even without iPhone changes. After each `Submit iOS` run, the `iOS dSYMs` workflow (`.github/workflows/ios-dsyms.yml` → `tools/upload-dsyms.py`, on macOS) downloads that release's archive from Xcode Cloud and uploads its dSYMs to PostHog (secret `POSTHOG_CLI_API_KEY`), so iPhone crash reports are symbolicated; run it by hand with a version after a manual `Submit iOS` or to upload an older one ([iPhone crash tracing](iphone-crash-tracing.md)). `python3 tools/asc-submit-test.py` checks the PR parsing and the change detection. `DRY_RUN=1 tools/asc-submit.py <version>` prints the writes without making them.
+The Xcode Cloud workflow "Release" on the product "iOS" has no automatic start condition (its own tag trigger never fired); it only runs when started through the API, and it archives the `iOS` scheme in Release with deployment preparation **TestFlight and App Store** (the "Internal Testing Only" option produces builds App Review can't take) and uploads it to App Store Connect. Xcode Cloud overrides the build number with its own counter (`CI_BUILD_NUMBER`, configured under Xcode Cloud settings → Build Number in App Store Connect), so `CURRENT_PROJECT_VERSION` in `project.yml` is only the local default. The checked-in `apps/Codync.xcodeproj` is what the cloud builds: regenerate it whenever `project.yml` changes, and commit `apps/Codync.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved` whenever a package version changes (Xcode Cloud never resolves packages itself; copy `apps/ios/Kit/Package.resolved` there if Xcode wrote it to `apps/ios/Kit/`). Xcode Cloud reads public package repositories without any connection. The `Submit iOS` GitHub workflow (`.github/workflows/ios-submit.yml` → `tools/asc-submit.py`, secrets `ASC_KEY_ID`, `ASC_ISSUER_ID`, `ASC_PRIVATE_KEY`) runs on every `v*` tag (the tags Auto Tag pushes after a version bump on `main`). It compares the tag with the last version sent to App Review (a version never sent or pulled back, such as one a failed run left behind, doesn't count; a rejected one does): when nothing the iPhone app is built from changed (`apps/ios/` including `apps/ios/Kit/`, except `WhatsNew.md` and the Kit tests, `apps/shared/`, the package pins, or `apps/project.yml` beyond its version lines), iOS skips that release, so host- or desktop-only releases neither build nor touch a version in review. Otherwise it starts the Xcode Cloud archive on the tag, waits for that build to finish processing and submits it for App Review, released automatically after approval. The latest version wins: a version still *Waiting for Review* is pulled back, renamed and resubmitted with the new build; one already *In Review* or approved is left alone (rerun the workflow with the version once it is out). *What's New* comes from the version's `## <version>` section in `apps/ios/WhatsNew.md` (one `### <locale>` per App Store language, written in the version bump); without one, the `### zh-Hant` / `### en-US` bullets under `## What's New` in the PR template are collected from every PR merged since the last App Store version (changes pushed to `main` without a PR add nothing); with neither, empty fields get a generic "Bug fixes and improvements" line. Running `Submit iOS` by hand with a version ships it even without iPhone changes. After each `Submit iOS` run, the `iOS dSYMs` workflow (`.github/workflows/ios-dsyms.yml` → `tools/upload-dsyms.py`, on macOS) downloads that release's archive from Xcode Cloud and uploads its dSYMs to PostHog (secret `POSTHOG_CLI_API_KEY`), so iPhone crash reports are symbolicated; run it by hand with a version after a manual `Submit iOS` or to upload an older one ([iPhone crash tracing](iphone-crash-tracing.md)). `python3 tools/asc-submit-test.py` checks the PR parsing and the change detection. `DRY_RUN=1 tools/asc-submit.py <version>` prints the writes without making them.
diff --git a/tools/asc-submit-test.py b/tools/asc-submit-test.py
index 19cd22c3..54955fe1 100644
--- a/tools/asc-submit-test.py
+++ b/tools/asc-submit-test.py
@@ -41,4 +41,17 @@ print("ok")
# Release history: v2.2.3 changed only the Mac app, host and website; v2.3.1 changed kit/.
assert not asc.ios_changed("v2.2.2", "v2.2.3")
assert asc.ios_changed("v2.3.0", "v2.3.1")
+assert not asc.ios_changed("v2.19.2", "v2.19.3") # only WhatsNew.md under apps/ios
+assert asc.ios_changed("v2.19.1", "v2.19.2")
+print("ok")
+
+# The base version: skip the run's own version and any never sent or pulled back, keep a rejected one.
+def store(*vs):
+ return [{"attributes": {"versionString": v, "appVersionState": s}} for v, s in vs]
+
+
+assert asc.last_sent(store(("2.19.3", "PREPARE_FOR_SUBMISSION"), ("2.19.2", "READY_FOR_DISTRIBUTION")), "2.19.4") == "2.19.2"
+assert asc.last_sent(store(("2.19.3", "WAITING_FOR_REVIEW"), ("2.19.2", "READY_FOR_DISTRIBUTION")), "2.19.3") == "2.19.2"
+assert asc.last_sent(store(("2.20.0", "REJECTED"), ("2.19.2", "READY_FOR_DISTRIBUTION")), "2.20.1") == "2.20.0"
+assert asc.last_sent(store(("2.19.3", "DEVELOPER_REJECTED")), "2.19.4") is None
print("ok")
diff --git a/tools/asc-submit.py b/tools/asc-submit.py
index a2051433..e12d4732 100755
--- a/tools/asc-submit.py
+++ b/tools/asc-submit.py
@@ -6,8 +6,8 @@ Env: ASC_KEY_ID, ASC_ISSUER_ID, ASC_PRIVATE_KEY (.p8 contents); DRY_RUN=1 prints
SINCE (ISO 8601) ignores builds uploaded before it, so a tag run never submits an older build.
Runs in a checkout with the release tags.
-A release whose tag changes nothing the iPhone app is built from since the last App Store
-version is skipped (FORCE=1 ships it anyway). Otherwise it starts the Xcode Cloud archive
+A release whose tag changes nothing the iPhone app is built from since the last version sent
+to App Review is skipped (FORCE=1 ships it anyway). Otherwise it starts the Xcode Cloud archive
on the tag (only when SINCE is set or no build of the version exists yet) and waits for it.
What's New comes from the version's section in apps/ios/WhatsNew.md, else from the
@@ -34,15 +34,18 @@ import jwt
APP_ID = "6760984418"
API = "https://api.appstoreconnect.apple.com/v1"
WHATS_NEW = {"en-US": "Bug fixes and improvements.", "zh-Hant": "錯誤修正與改進。"}
-EDITABLE = {"PREPARE_FOR_SUBMISSION", "READY_FOR_REVIEW", "DEVELOPER_REJECTED", "REJECTED",
- "METADATA_REJECTED", "INVALID_BINARY"}
+UNSENT = {"PREPARE_FOR_SUBMISSION", "READY_FOR_REVIEW", "DEVELOPER_REJECTED"} # never sent, or pulled back
+EDITABLE = UNSENT | {"REJECTED", "METADATA_REJECTED", "INVALID_BINARY"}
DONE = {"READY_FOR_DISTRIBUTION", "REPLACED_WITH_NEW_VERSION", "REMOVED_FROM_SALE"}
DRY_RUN = os.environ.get("DRY_RUN") == "1"
NOTES = Path(__file__).resolve().parent.parent / "apps/ios/WhatsNew.md"
EMOJI = re.compile("[\U00010000-\U0010FFFF\u2600-\u27BF\uFE0F\u200D]")
WORKFLOW_ID = "44342080-ce08-4dc1-be35-34ce6cbb41b5" # Xcode Cloud "Release": Archive iOS for the App Store
# What the iPhone app is built from; apps/project.yml counts except its version lines.
-IOS_PATHS = ["apps/ios", "apps/shared", "apps/Codync.xcodeproj/project.xcworkspace"]
+# The App Store notes and the Kit tests never reach the binary.
+# ponytail: project.yml's macOS Screen targets count too; diff only its iOS targets if that misfires.
+IOS_PATHS = ["apps/ios", "apps/shared", "apps/Codync.xcodeproj/project.xcworkspace",
+ ":(exclude)apps/ios/WhatsNew.md", ":(exclude)apps/ios/Kit/Tests"]
def git(*args):
@@ -128,6 +131,21 @@ def all_pages(path):
return items
+def store_versions():
+ """The app's last ten iOS App Store versions with their states."""
+ return call("GET", f"/apps/{APP_ID}/appStoreVersions?filter[platform]=IOS&limit=10"
+ "&fields[appStoreVersions]=versionString,appVersionState")["data"]
+
+
+def last_sent(versions, version):
+ """The newest other version sent to App Review. One never sent or pulled back (such as one a
+ failed run left behind) doesn't count, so its changes still ship; a rejected one does, so a
+ release without iPhone changes doesn't resubmit the rejected code."""
+ return next((v["attributes"]["versionString"] for v in versions
+ if v["attributes"]["versionString"] != version
+ and v["attributes"]["appVersionState"] not in UNSENT), None)
+
+
def start_archive(tag):
repo = call("GET", f"/ciWorkflows/{WORKFLOW_ID}/repository")["data"]["id"]
ref = wait_for(f"Xcode Cloud to see {tag}", lambda: next((
@@ -142,10 +160,7 @@ def start_archive(tag):
def main(version):
tag = f"v{version}"
since = datetime.fromisoformat(os.environ.get("SINCE", "2000-01-01T00:00:00Z"))
- shipped = next((v["attributes"]["versionString"] for v in call(
- "GET", f"/apps/{APP_ID}/appStoreVersions?filter[platform]=IOS&limit=10"
- "&fields[appStoreVersions]=versionString")["data"]
- if v["attributes"]["versionString"] != version), None)
+ shipped = last_sent(store_versions(), version)
base = f"v{shipped}" if shipped and git("tag", "-l", f"v{shipped}") else \
git("describe", "--tags", "--abbrev=0", "--match", "v*", f"{tag}^")
if os.environ.get("FORCE") != "1" and base and not ios_changed(base, tag):
@@ -163,9 +178,7 @@ def main(version):
print(f"build {build['attributes']['version']} ({build['id']})")
def in_flight():
- versions = call("GET", f"/apps/{APP_ID}/appStoreVersions?filter[platform]=IOS&limit=10"
- "&fields[appStoreVersions]=versionString,appVersionState")["data"]
- return next((v for v in versions if v["attributes"]["appVersionState"] not in DONE), None)
+ return next((v for v in store_versions() if v["attributes"]["appVersionState"] not in DONE), None)
current = in_flight()
state = current and current["attributes"]["appVersionState"]