ci: ship Forgr through Capgo Live Update and Capgo Build
What
Adds .github/workflows/capgo.yml, the first CI/CD for Forgr (app.capgo.mapp, channel production): every push to main ships either a Capgo live update (OTA) or a Capgo native build, and PRs only run typecheck, test and build.
- Live updates (
upload-ota): the web build is uploaded as a delta bundle to the channel, version<package.json version>+build.<run_number>, with--fail-on-incompatibleand--auto-min-update-version. - Native builds (
build-ios,build-android):@capgo/cli build requestfor iOS (scheme/targetApp, which embeds theForgrWidgetextension,app_storedistribution) and Android. Everybuild requestpasses--use-stored-credentials(signing material lives on Capgo, no signing secrets in GitHub) and--output-upload --output-retention 7d, so each build stays on Capgo for 7 days and installs in the Capgo cloud simulator (capgo simulator start --build-job <jobId>). - PR CI: on pull requests only
verifyruns (bun run typecheck,bun run test,bun run build). Nothing is uploaded or built on Capgo from a PR.
Release marker tag: capgo-native-production
The tag capgo-native-<channel> (capgo-native-production) points at the commit of the last successful native release.
detect-releasechecks out full history and tags and fetches the tag. If the tag is missing the run fails (fail closed) with instructions to create it.- It diffs
<tag>..HEAD, not the pushed range, so a failed or skipped native release is retried on the next push instead of being lost (replaces thegithub.event.beforediff). upload-native-baselinemoves the tag togithub.sha(git tag -f+git push -f origin refs/tags/capgo-native-<channel>) after both native builds succeed. That job is the only one withpermissions: contents: write; everything else iscontents: read.
Bootstrap (one time, before the first push to main after merge)
Create the tag at the commit the current store binaries were built from:
git tag capgo-native-production <commit-of-last-native-release>
git push origin refs/tags/capgo-native-production
The tag has not been created yet. The last local store release is 4f7df32 ("chore: release 1.3.6 (iOS 18, Android 10308) with dependency updates"), but main has a later native-path commit, 1ca7a0e ("chore: sync native projects and bump iOS build to 19"), which adds @capgo/capacitor-native-navigation to the Android Gradle sync files and moves iOS to build 19. Which of the two the shipped iOS and Android binaries match has to be confirmed before tagging. If unsure, tagging 4f7df32 is the safe choice: the next push then sees native changes and asks for a version bump before building.
How live update vs native build is chosen
verifybuildsdistonce and shares it as an artifact.detect-release:- Manual
workflow_dispatchwithrelease_targetotaornativewins (a forced native build still has to pass the version gate). - Any native path changed in
<tag>..HEADmeans native:ios/(includingForgrWidget),android/,capacitor.config.*, the local plugins' native parts (plugins/*/ios/,plugins/*/android/,plugins/*/package.json), and any*.podspecorPackage.swift. - Otherwise
bunx @capgo/cli bundle releaseType app.capgo.mapp --channel productioncompares the native packages with the channel and answersOTAornative.
- Manual
OTArunsupload-ota;nativerunsbuild-iosandbuild-android(each runscap sync <platform>first). Manual dispatch can also pick the platform (ios,android,both), the channel andrelease/debugbuild mode.
Native version gate
The native version is the root package.json version, synced into both binaries with --sync-ios-version / --sync-android-version (build numbers are auto-bumped by the CLI). A native release requires that version to be strictly greater (semver) than the package.json version at the release tag; otherwise detect-release fails before any build with an error asking to bump version. This keeps every native release distinguishable by version, which the channel's min-update-version floor relies on.
Channel strategy and bundle versions
- Both upload jobs first run, idempotently,
channel set production app.capgo.mapp --disable-auto-update metadata: every bundle carries a min update version and a device only gets a bundle when its native version is at least that. - OTA bundles:
<version>+build.<run_number>, keeping the current floor (--auto-min-update-version) and refusing native-incompatible bundles (--fail-on-incompatible). - Baseline after native:
upload-native-baselineruns only when the native path ran and both builds succeeded. It uploads the samedistas<version>+native.<run_number>.<run_attempt>without--fail-on-incompatibleand with--min-update-version <version>, so devices on an older binary never get it (or later OTAs, which inherit the floor), then moves the release tag. Single-platform manual builds advance neither the baseline nor the tag. - Semver build metadata (
+build.,+native.) sorts equal to<version>, so devices on the<version>binary still pass the channel's no-downgrade rule (a-build.prerelease would sort below it).
Triggers and safety
- Push to
mainand pull requests, ignoringwebsite/**,store/**,cloud/**,**/*.mdandrenovate.json. - Concurrency group per ref; runs on
mainqueue instead of cancelling (cancelling a job does not stop the Capgo cloud build it started). PR runs cancel in progress. - Only the org secret
CAPGO_TOKENis used.
Notes
bun run lintis not in CI because it currently fails onmain(typescript-eslint8.71 does not support TypeScript 7.0).bun.lockis lockfile version 2, so CI uses the latest Bun.tests/responses.test.tsnow provides its own in-memorylocalStorage, so it no longer depends on test order.
Checks
actionlint1.7.7 (with shellcheck): no findings.- The
detect-releasescript was run locally against a throwaway git repo with a bare remote: missing tag fails with the instructions; forcedotapasses; forcednativeand anios/App/ForgrWidgetchange both fail the version gate at 1.3.6 vs 1.3.6 and pass after bumping to 1.3.7; the tag-move step force-pushes the tag; a web-only change after the move falls through toreleaseType. The semver comparison was checked on core, prerelease and build-metadata cases. - CLI flags checked against
@capgo/cli@latesthelp (build request:--sync-ios-version,--sync-android-version,--use-stored-credentials,--output-upload,--output-retention;channel set:--disable-auto-update metadata). - On this PR only
Typecheck, test and buildapplies; release jobs are skipped forpull_requestevents by design. - No UI change, so no screenshots.
🤖 Generated with Claude Code
Summary by cubic
Adds a CI/CD workflow that ships Forgr through Capgo on every push to main, and stabilizes a flaky test. A detect job picks between live update and native build: a forced workflow_dispatch target wins, then changed native paths or Capacitor runtime bumps since the capgo-native-<channel> release tag force native, then Capgo's bundle releaseType compares native package metadata. A missing tag fails the run with instructions, and native releases require a strict semver bump of package.json over the version at the tag as well as a commit that descends from it.
- The tag points at the last successful native release, so a failed native release is retried on the next push; a forced native build must also descend from that tag, checked before any build or channel change. Native releases must target
CapacitorUpdater.defaultChannel, since binaries built for another channel would still follow the default one. - Native detection covers
ios/(incl.ForgrWidget),android/,capacitor.config.*, the native parts of the local plugins, resolved@capacitor/core|ios|androidversions inbun.lock, and any*.podspecorPackage.swift. - Web-only changes upload a delta live update; native changes request cloud builds for iOS and Android, signed with credentials stored on Capgo (no signing secrets in GitHub).
- Both upload jobs recheck the live release tag before touching the channel, so a re-run with stale detect outputs cannot roll back or overwrite a newer release. Since OTA releases never move the tag, the OTA job refuses to publish when the channel already holds a bundle from a later run; the native baseline job now applies the same run-number guard, because a re-run of a completed native release passes the tag check yet could replace a newer live update. After both native builds succeed in release mode, the same web build is uploaded again as the native baseline with
--min-update-version, then the tag moves forward to the built commit, pushed with a lease on the raw tag ref. - Debug builds never reach users, so they never publish a baseline or move the tag.
- Releases serialize per channel across refs so two runs never race on the tag; PR runs cancel each other.
- Push triggers skip
website/,store/,cloud/, Markdown, andrenovate.json, except Markdown undersrc/which the app bundles and must ship.
Bug Fixes
tests/responses.test.tsnow provides its own in-memorylocalStorage, so the consent check no longer depends on another test file installing the shim and failing in CI.
Summary by CodeRabbit
- New Features
- Changes can be published to Capgo as OTA updates or routed to native Android and iOS builds. Release type is selected automatically or can be specified for manual runs.
- Manual releases support channel, platform, and build-mode selection. Pull requests run verification without publishing.
- Release Requirements
- Native releases require a valid release baseline, a newer app version, and a commit based on that baseline.
- The baseline is updated only after successful release-mode builds for both platforms.