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.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
ci: ship iOS only when a release changes the iPhone app
leepokai76c2636b3b81
diff --git a/.github/workflows/ios-submit.yml b/.github/workflows/ios-submit.ymlindex b9bb1df7..7feda3e1 100644--- a/.github/workflows/ios-submit.yml+++ b/.github/workflows/ios-submit.yml@@ -1,7 +1,7 @@name: Submit iOS-# Xcode Cloud archives the iOS app on the same v* tag and uploads it to TestFlight;-# this waits for that build and submits it for App Review.+# On each v* tag that changes the iPhone app, starts the Xcode Cloud archive on that tag,+# waits for the upload and submits it for App Review. Host/macOS-only releases skip iOS.on:push:tags: ["v*"]@@ -36,12 +36,10 @@ jobs:VERSION: ${{ inputs.version || github.ref_name }}GH_TOKEN: ${{ github.token }}run: |- # PRs merged since the previous release tag supply What's New when apps/ios/WhatsNew.md has no section.- TAG="v${VERSION#v}"- PREV=$(git describe --tags --abbrev=0 --match 'v*' "$TAG^" 2>/dev/null || true)- git rev-list "${PREV:+$PREV..}$TAG" > "$RUNNER_TEMP/commits.txt"gh pr list --state merged --limit 200 --json body,mergeCommit > "$RUNNER_TEMP/prs.json"- export PRS="$RUNNER_TEMP/prs.json" COMMITS="$RUNNER_TEMP/commits.txt"+ export PRS="$RUNNER_TEMP/prs.json"+ # A manual run ships the version even without iPhone changes.+ [[ "$GITHUB_EVENT_NAME" == workflow_dispatch ]] && export FORCE=1# A tag run waits for the build Xcode Cloud starts now, not an older upload.[[ "$GITHUB_EVENT_NAME" == push ]] && export SINCE=$(date -u +%Y-%m-%dT%H:%M:%SZ)python3 tools/asc-submit.py "${VERSION#v}"diff --git a/docs/guides/development.md b/docs/guides/development.mdindex b2f73596..8756252e 100644--- a/docs/guides/development.md+++ b/docs/guides/development.md@@ -93,4 +93,4 @@ Versions are defined in `apps/project.yml`; keep the host package version aligne## iOS releases (Xcode Cloud)-The Xcode Cloud workflow on the Codync product starts on tag changes matching `v*` (the tags Auto Tag pushes after a version bump on `main`), 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 `kit/Package.resolved` there if Xcode wrote it to `kit/`). Xcode Cloud reads public package repositories without any connection; its setup wizard still blocked on Sparkle (asking for a GitHub app install only its owners can grant), so the product was created with Sparkle temporarily removed from `project.yml`. 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 the same tag: it waits for that version's build to finish processing, then 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 previous `v*` tag (changes pushed to `main` without a PR add nothing); with neither, empty fields get a generic "Bug fixes and improvements" line. `python3 tools/asc-submit-test.py` checks the PR parsing. `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 `kit/Package.resolved` there if Xcode wrote it to `kit/`). Xcode Cloud reads public package repositories without any connection; its setup wizard still blocked on Sparkle (asking for a GitHub app install only its owners can grant), so the product was created with Sparkle temporarily removed from `project.yml`. 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/`, `apps/shared/`, `kit/`, the package pins, or `apps/project.yml` beyond its version lines), iOS skips that release, so host- or Mac-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. `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.pyindex f3032982..4068ce42 100644--- a/tools/asc-submit-test.py+++ b/tools/asc-submit-test.py@@ -24,3 +24,8 @@ assert asc.pr_notes(prs, {"a", "b", "c"}) == {"zh-Hant": "- 例行任務改用同一個表單", "en-US": "- Routines use one form"}, asc.pr_notes(prs, {"a", "b", "c"})assert asc.pr_notes(prs, {"c"}) == {}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")+print("ok")diff --git a/tools/asc-submit.py b/tools/asc-submit.pyindex 1a6c8f46..988bb0a1 100755--- a/tools/asc-submit.py+++ b/tools/asc-submit.py@@ -4,17 +4,22 @@Usage: asc-submit.py 2.3.0Env: ASC_KEY_ID, ASC_ISSUER_ID, ASC_PRIVATE_KEY (.p8 contents); DRY_RUN=1 prints writes instead;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+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-"## What's New" bullets of the PRs merged into this release (PRS: `gh pr list --json-body,mergeCommit` output, COMMITS: `git rev-list` of the release); without either, empty-fields get a generic line.+"## What's New" bullets of the PRs merged since the last App Store version (PRS: `gh pr list+--json body,mergeCommit` output); without either, empty fields get a generic line.Latest version wins: a version still waiting for review is pulled back, renamed andresubmitted with the new build. A version already in review is left alone."""import json+import subprocessimport osimport sysimport time@@ -34,6 +39,22 @@ EDITABLE = {"PREPARE_FOR_SUBMISSION", "READY_FOR_REVIEW", "DEVELOPER_REJECTED",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"+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", "kit", "apps/Codync.xcodeproj/project.xcworkspace"]+++def git(*args):+ return subprocess.run(["git", *args], capture_output=True, text=True, check=False).stdout.strip()+++def ios_changed(base, tag):+ """Whether anything the iPhone app is built from differs between two refs."""+ if git("diff", "--name-only", base, tag, "--", *IOS_PATHS):+ return True+ project = git("diff", "-U0", base, tag, "--", "apps/project.yml").splitlines()+ return any(line[:1] in "+-" and line[:3] not in ("+++", "---") and "_VERSION" not in line+ for line in project)def release_notes(version):@@ -93,8 +114,43 @@ def wait_for(what, check, minutes):sys.exit(f"timed out waiting for {what}")+def all_pages(path):+ items = []+ while path:+ page = call("GET", path)+ items += page["data"]+ path = page.get("links", {}).get("next", "").removeprefix(API)+ return items+++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((+ r["id"] for r in all_pages(f"/scmRepositories/{repo}/gitReferences?limit=200")+ if r["attributes"]["canonicalName"] == f"refs/tags/{tag}"), None), 15)+ run = call("POST", "/ciBuildRuns", {"data": {"type": "ciBuildRuns", "relationships": {+ "workflow": {"data": {"type": "ciWorkflows", "id": WORKFLOW_ID}},+ "sourceBranchOrTag": {"data": {"type": "scmGitReferences", "id": ref}}}}})["data"]+ print(f"started Xcode Cloud build {run.get('attributes', {}).get('number', run['id'])} on {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)+ 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):+ print(f"nothing the iPhone app is built from changed since {base}; not shipping iOS {version}")+ return+ print(f"iOS changes since {base or 'the start'}")++ builds = call("GET", f"/builds?filter[app]={APP_ID}&filter[preReleaseVersion.version]={version}&limit=1")+ if "SINCE" in os.environ or not builds["data"]:+ start_archive(tag)build = wait_for(f"build {version} to finish processing", lambda: next(iter(b for b in call("GET", f"/builds?filter[app]={APP_ID}&filter[preReleaseVersion.version]={version}""&filter[processingState]=VALID&sort=-uploadedDate&limit=1")["data"]@@ -136,8 +192,9 @@ def main(version):notes, source = release_notes(version), "WhatsNew.md"if not notes and os.environ.get("PRS"):- with open(os.environ["PRS"]) as prs, open(os.environ["COMMITS"]) as commits:- notes, source = pr_notes(json.load(prs), set(commits.read().split())), "PRs"+ with open(os.environ["PRS"]) as prs:+ commits = set(git("rev-list", f"{base}..{tag}" if base else tag).split())+ notes, source = pr_notes(json.load(prs), commits), "PRs"print(f"What's New from {source}: {sorted(notes) or 'none, generic text'}")if version_id != "dry-run":for loc in call("GET", f"/appStoreVersions/{version_id}/appStoreVersionLocalizations")["data"]: