Mobile CI/CD Pipeline Generator
Purpose & When-To-Use
Use this skill when you need to:
- Bootstrap CI/CD for a new iOS or Android mobile application
- Automate builds for React Native or Flutter projects on GitHub Actions or GitLab CI
- Set up beta distribution to TestFlight, Firebase App Distribution, or Play Store internal testing
- Configure code signing using Fastlane Match or manual certificate management
- Integrate crash reporting (Sentry, Firebase Crashlytics) into build pipelines
- Standardize mobile DevOps across teams with repeatable pipeline templates
Trigger conditions:
- Project lacks automated mobile builds or manual build processes are error-prone
- Need to distribute beta builds to testers or stakeholders regularly
- Require consistent code signing across team members or CI environments
- Want to automate app store submissions and release management
Pre-Checks
Before generating pipelines, verify:
- Compute NOW_ET using NIST/time.gov semantics (America/New_York, ISO-8601) for all access dates
- Platform validity:
platform ∈ {ios, android, react-native, flutter}
ci_platform ∈ {github-actions, gitlab-ci, bitrise, app-center}
- Input schema sanity:
- If
platform=ios, signing_method should be specified (default: fastlane-match)
- If
platform=android, ensure keystore details are available or documented
- If
distribution=testflight, confirm Apple Developer account and App Store Connect API key access
- If
distribution=play-internal, confirm Google Play Console service account JSON
- Source freshness:
- Fastlane version compatibility (accessed 2025-10-26T03:51:56-04:00): v2.220+
- Android Gradle Plugin (accessed 2025-10-26T03:51:56-04:00): AGP 8.0+ recommended
- GitHub Actions runner images (macos-latest for iOS, ubuntu-latest for Android)
- Abort if:
- Required platform-specific tools are unavailable (Xcode for iOS, Java/Gradle for Android)
- Code signing credentials or API keys are not provisioned
- Distribution channel access is not confirmed
Procedure
T1: Basic Build Pipeline (≤2k tokens)
Common 80% case: Compile and test mobile app on CI without distribution.
Steps:
- Detect platform and CI system from inputs
- Generate base CI workflow:
- iOS: macOS runner, Xcode build, unit tests
- Android: Ubuntu runner, Gradle assemble, unit tests
- React Native/Flutter: Detect native platforms, run dual iOS+Android jobs
- Configure caching:
- iOS:
~/Library/Caches/CocoaPods, vendor/bundle
- Android:
~/.gradle/caches, ~/.gradle/wrapper
- Run linting and tests:
- iOS:
xcodebuild test
- Android:
./gradlew test
- React Native:
npm test or yarn test
- Output: Basic CI YAML (GitHub Actions or GitLab CI) for build verification
Example snippet (GitHub Actions, iOS):
name: iOS CI
on: [push, pull_request]
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: bundle install
- name: Build
run: xcodebuild -workspace App.xcworkspace -scheme App build-for-testing
- name: Test
run: xcodebuild test -workspace App.xcworkspace -scheme App -destination 'platform=iOS Simulator,name=iPhone 15'
Token budget: ~1.5k tokens
T2: Code Signing & Beta Distribution (≤6k tokens)
Extended case: Add code signing and automated beta uploads.
Additional steps:
- iOS code signing setup:
- Fastlane Match: Configure
Matchfile, store certificates in encrypted git repo or cloud storage
- Manual: Document certificate/provisioning profile upload to CI secrets
- Reference: Fastlane Match documentation (accessed 2025-10-26T03:51:56-04:00)
- Android code signing:
- Beta distribution:
- TestFlight (iOS): Use
fastlane pilot upload or altool/Transporter API
- Requires App Store Connect API key (stored as CI secret)
- Firebase App Distribution: Use
firebase appdistribution:distribute CLI
- Play Store Internal Testing (Android): Use
fastlane supply or Google Play Developer API
- Generate Fastfile (iOS):
lane :beta do
match(type: "appstore")
build_app(scheme: "App", export_method: "app-store")
upload_to_testflight(skip_waiting_for_build_processing: true)
end
- Output: CI pipeline with signing and distribution steps, Fastfile, secrets checklist
Token budget: ~5k tokens
T3: Release Automation & Crash Reporting (≤12k tokens)
Deep dive: Full release pipeline with crash reporting and advanced features.
Additional steps:
- Production release automation:
- iOS: Automate App Store submission with screenshots, metadata, phased rollout
- Android: Automate Play Store production track deployment with staged rollout percentages
- Use
fastlane deliver (iOS) or fastlane supply (Android) with metadata management
- Crash reporting integration:
- Sentry: Add Sentry CLI upload of debug symbols/source maps
- iOS: Upload dSYMs with
sentry-cli upload-dif
- Android: Upload ProGuard/R8 mapping files
- Reference: Sentry Mobile Setup (accessed 2025-10-26T03:51:56-04:00)
- Firebase Crashlytics: Integrate Crashlytics SDK, upload symbols automatically
- CodePush setup (React Native):
- Install
appcenter-cli, configure CodePush release command
- Deploy JS bundle updates without app store review
- Version bumping and changelog:
- Automate version increments (
agvtool, gradle version bump)
- Generate release notes from git commits or PR descriptions
- Notification and reporting:
- Slack/Discord notifications on build success/failure
- Upload build artifacts (IPA, APK, AAB) to GitHub Releases or artifact storage
- Evals and quality gates:
- Run automated UI tests (Detox, Appium)
- Performance profiling and bundle size checks
- Security scanning (dependency audit, SAST)
Token budget: ~10k tokens
Decision Rules
Ambiguity thresholds:
- If
platform=react-native or flutter, default to dual iOS+Android builds unless explicitly single-platform
- If
signing_method unspecified:
- iOS: default to
fastlane-match (team environments)
- Android: default to
manual (requires keystore upload)
- If
distribution unspecified, stop at T1 (build-only, no beta distribution)
- If
crash_reporting=none, omit symbol upload steps
Abort/stop conditions:
- Missing required CI secrets (certificates, API keys) → output secrets checklist and halt
- Unsupported CI platform (e.g., Jenkins, Travis) → suggest GitHub Actions or GitLab CI migration
- Platform mismatch (e.g.,
platform=ios with distribution=play-internal) → reject and clarify
Escalation:
- If user needs custom build steps (e.g., native module compilation, custom signing flows), provide hook points in CI YAML and document extension pattern
Output Contract
interface MobileCICDOutput {
ci_pipeline: {
file_path: string; // e.g., ".github/workflows/mobile-ci.yml"
format: "yaml";
platform: "github-actions" | "gitlab-ci";
jobs: Array<{
name: string; // e.g., "ios-build", "android-release"
runner: string; // e.g., "macos-latest", "ubuntu-latest"
steps: number; // count of CI steps
}>;
};
fastlane_config?: { // optional, iOS-only
file_path: string; // "fastlane/Fastfile"
lanes: string[]; // e.g., ["beta", "release"]
};
gradle_config?: { // optional, Android-only
snippet: string; // signing config block for build.gradle
};
distribution_setup: {
platform: string; // "testflight" | "firebase" | "play-internal"
instructions: string; // markdown setup guide
required_credentials: string[]; // e.g., ["APP_STORE_CONNECT_API_KEY"]
};
secrets_checklist: {
secrets: Array<{
name: string; // e.g., "MATCH_PASSWORD"
description: string;
required_for: string[]; // e.g., ["ios-beta", "ios-release"]
}>;
};
token_usage: number; // actual tokens consumed
tier: "T1" | "T2" | "T3";
}
Required fields:
ci_pipeline.file_path and ci_pipeline.jobs (always)
secrets_checklist.secrets (if signing or distribution enabled)
distribution_setup (if T2+)
Validation:
- CI YAML must parse without syntax errors
- Fastfile must use valid Fastlane actions
- Gradle snippet must be syntactically valid Groovy
Examples
Example 1: React Native app with iOS/Android builds and TestFlight beta
Input:
{
"platform": "react-native",
"ci_platform": "github-actions",
"distribution": "testflight",
"signing_method": "fastlane-match",
"crash_reporting": "sentry"
}
Output (GitHub Actions excerpt, ≤30 lines):
name: React Native CI/CD
on: [push, pull_request]
jobs:
ios-beta:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install
- name: Install pods
run: cd ios && pod install
- name: Fastlane beta
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.APP_SPECIFIC_PASSWORD }}
run: cd ios && bundle exec fastlane beta
- name: Upload dSYMs to Sentry
run: npx sentry-cli upload-dif --org my-org --project my-project ios/build
android-beta:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with: { java-version: '17' }
- run: npm install
- name: Build release APK
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
run: cd android && ./gradlew assembleRelease
- name: Upload to Firebase
run: firebase appdistribution:distribute app/build/outputs/apk/release/app-release.apk --app ${{ secrets.FIREBASE_APP_ID }}
Quality Gates
Token budgets (enforced):
- T1 ≤ 2k tokens (build-only)
- T2 ≤ 6k tokens (signing + beta distribution)
- T3 ≤ 12k tokens (release automation + crash reporting)
Safety:
- Never emit secrets directly in YAML; always use
${{ secrets.SECRET_NAME }} placeholders
- Validate CI secrets exist before pipeline runs (check CI provider docs)
- Warn if keystore or certificates are stored in version control (security risk)
Auditability:
- All CI jobs must log build numbers, commit SHAs, and artifact URLs
- Crash reporting symbol uploads must confirm success/failure
- Beta distribution must report uploaded build version and tester group
Determinism:
- Pin Fastlane versions in Gemfile
- Pin Gradle plugin versions in build.gradle
- Use locked dependency versions (package-lock.json, Gemfile.lock)
Performance:
- Cache dependencies aggressively (CocoaPods, Gradle, npm)
- Parallelize iOS and Android builds when possible
- Avoid redundant builds (skip CI on docs-only changes)
Resources
Official Documentation (accessed 2025-10-26T03:51:56-04:00):
Templates and Tools:
Best Practices:
- Use Fastlane Match for team-based iOS development to avoid certificate conflicts
- Store Android keystores in CI secrets, never commit to version control
- Enable incremental builds and caching to reduce CI duration
- Test beta distributions on real devices before production release
- Monitor crash-free user rates in Sentry/Crashlytics dashboards
END OF SKILL
1---2name: mobile-ci-cd-pipeline-generator3description: Generate mobile CI/CD pipelines for iOS (Fastlane, TestFlight) and Android (Gradle, Play Store) with code signing, beta distribution, and crash reporting4license: MIT5---67# Mobile CI/CD Pipeline Generator89## Purpose & When-To-Use1011Use this skill when you need to:1213- **Bootstrap CI/CD** for a new iOS or Android mobile application14- **Automate builds** for React Native or Flutter projects on GitHub Actions or GitLab CI15- **Set up beta distribution** to TestFlight, Firebase App Distribution, or Play Store internal testing16- **Configure code signing** using Fastlane Match or manual certificate management17- **Integrate crash reporting** (Sentry, Firebase Crashlytics) into build pipelines18- **Standardize mobile DevOps** across teams with repeatable pipeline templates1920**Trigger conditions:**2122- Project lacks automated mobile builds or manual build processes are error-prone23- Need to distribute beta builds to testers or stakeholders regularly24- Require consistent code signing across team members or CI environments25- Want to automate app store submissions and release management2627---2829## Pre-Checks3031Before generating pipelines, verify:32331. **Compute NOW_ET** using NIST/time.gov semantics (America/New_York, ISO-8601) for all access dates342. **Platform validity:**35 - `platform` ∈ {ios, android, react-native, flutter}36 - `ci_platform` ∈ {github-actions, gitlab-ci, bitrise, app-center}373. **Input schema sanity:**38 - If `platform=ios`, `signing_method` should be specified (default: fastlane-match)39 - If `platform=android`, ensure keystore details are available or documented40 - If `distribution=testflight`, confirm Apple Developer account and App Store Connect API key access41 - If `distribution=play-internal`, confirm Google Play Console service account JSON424. **Source freshness:**43 - Fastlane version compatibility (accessed 2025-10-26T03:51:56-04:00): v2.220+44 - Android Gradle Plugin (accessed 2025-10-26T03:51:56-04:00): AGP 8.0+ recommended45 - GitHub Actions runner images (macos-latest for iOS, ubuntu-latest for Android)465. **Abort if:**47 - Required platform-specific tools are unavailable (Xcode for iOS, Java/Gradle for Android)48 - Code signing credentials or API keys are not provisioned49 - Distribution channel access is not confirmed5051---5253## Procedure5455### T1: Basic Build Pipeline (≤2k tokens)5657**Common 80% case:** Compile and test mobile app on CI without distribution.5859**Steps:**60611. **Detect platform and CI system** from inputs622. **Generate base CI workflow:**63 - **iOS:** macOS runner, Xcode build, unit tests64 - **Android:** Ubuntu runner, Gradle assemble, unit tests65 - **React Native/Flutter:** Detect native platforms, run dual iOS+Android jobs663. **Configure caching:**67 - iOS: `~/Library/Caches/CocoaPods`, `vendor/bundle`68 - Android: `~/.gradle/caches`, `~/.gradle/wrapper`694. **Run linting and tests:**70 - iOS: `xcodebuild test`71 - Android: `./gradlew test`72 - React Native: `npm test` or `yarn test`735. **Output:** Basic CI YAML (GitHub Actions or GitLab CI) for build verification7475**Example snippet (GitHub Actions, iOS):**7677```yaml78name: iOS CI79on: [push, pull_request]80jobs:81 build:82 runs-on: macos-latest83 steps:84 - uses: actions/checkout@v485 - name: Install dependencies86 run: bundle install87 - name: Build88 run: xcodebuild -workspace App.xcworkspace -scheme App build-for-testing89 - name: Test90 run: xcodebuild test -workspace App.xcworkspace -scheme App -destination 'platform=iOS Simulator,name=iPhone 15'91```9293**Token budget:** ~1.5k tokens9495---9697### T2: Code Signing & Beta Distribution (≤6k tokens)9899**Extended case:** Add code signing and automated beta uploads.100101**Additional steps:**1021031. **iOS code signing setup:**104 - **Fastlane Match:** Configure `Matchfile`, store certificates in encrypted git repo or cloud storage105 - **Manual:** Document certificate/provisioning profile upload to CI secrets106 - Reference: [Fastlane Match documentation](https://docs.fastlane.tools/actions/match/) (accessed 2025-10-26T03:51:56-04:00)1072. **Android code signing:**108 - Generate or use existing keystore file109 - Store keystore password, key alias, key password in CI secrets110 - Add signing config to `build.gradle`:111 ```groovy112 android {113 signingConfigs {114 release {115 storeFile file(System.getenv("KEYSTORE_FILE"))116 storePassword System.getenv("KEYSTORE_PASSWORD")117 keyAlias System.getenv("KEY_ALIAS")118 keyPassword System.getenv("KEY_PASSWORD")119 }120 }121 }122 ```123 - Reference: [Android signing documentation](https://developer.android.com/studio/publish/app-signing) (accessed 2025-10-26T03:51:56-04:00)1243. **Beta distribution:**125 - **TestFlight (iOS):** Use `fastlane pilot upload` or `altool`/Transporter API126 - Requires App Store Connect API key (stored as CI secret)127 - **Firebase App Distribution:** Use `firebase appdistribution:distribute` CLI128 - Reference: [Firebase App Distribution CLI](https://firebase.google.com/docs/app-distribution/android/distribute-cli) (accessed 2025-10-26T03:51:56-04:00)129 - **Play Store Internal Testing (Android):** Use `fastlane supply` or Google Play Developer API1304. **Generate Fastfile (iOS):**131 ```ruby132 lane :beta do133 match(type: "appstore")134 build_app(scheme: "App", export_method: "app-store")135 upload_to_testflight(skip_waiting_for_build_processing: true)136 end137 ```1385. **Output:** CI pipeline with signing and distribution steps, Fastfile, secrets checklist139140**Token budget:** ~5k tokens141142---143144### T3: Release Automation & Crash Reporting (≤12k tokens)145146**Deep dive:** Full release pipeline with crash reporting and advanced features.147148**Additional steps:**1491501. **Production release automation:**151 - **iOS:** Automate App Store submission with screenshots, metadata, phased rollout152 - **Android:** Automate Play Store production track deployment with staged rollout percentages153 - Use `fastlane deliver` (iOS) or `fastlane supply` (Android) with metadata management1542. **Crash reporting integration:**155 - **Sentry:** Add Sentry CLI upload of debug symbols/source maps156 - iOS: Upload dSYMs with `sentry-cli upload-dif`157 - Android: Upload ProGuard/R8 mapping files158 - Reference: [Sentry Mobile Setup](https://docs.sentry.io/platforms/react-native/) (accessed 2025-10-26T03:51:56-04:00)159 - **Firebase Crashlytics:** Integrate Crashlytics SDK, upload symbols automatically1603. **CodePush setup (React Native):**161 - Install `appcenter-cli`, configure CodePush release command162 - Deploy JS bundle updates without app store review1634. **Version bumping and changelog:**164 - Automate version increments (`agvtool`, `gradle version bump`)165 - Generate release notes from git commits or PR descriptions1665. **Notification and reporting:**167 - Slack/Discord notifications on build success/failure168 - Upload build artifacts (IPA, APK, AAB) to GitHub Releases or artifact storage1696. **Evals and quality gates:**170 - Run automated UI tests (Detox, Appium)171 - Performance profiling and bundle size checks172 - Security scanning (dependency audit, SAST)173174**Token budget:** ~10k tokens175176---177178## Decision Rules179180**Ambiguity thresholds:**181182- If `platform=react-native` or `flutter`, **default to dual iOS+Android builds** unless explicitly single-platform183- If `signing_method` unspecified:184 - iOS: default to `fastlane-match` (team environments)185 - Android: default to `manual` (requires keystore upload)186- If `distribution` unspecified, **stop at T1** (build-only, no beta distribution)187- If `crash_reporting=none`, omit symbol upload steps188189**Abort/stop conditions:**190191- Missing required CI secrets (certificates, API keys) → output secrets checklist and halt192- Unsupported CI platform (e.g., Jenkins, Travis) → suggest GitHub Actions or GitLab CI migration193- Platform mismatch (e.g., `platform=ios` with `distribution=play-internal`) → reject and clarify194195**Escalation:**196197- If user needs custom build steps (e.g., native module compilation, custom signing flows), provide hook points in CI YAML and document extension pattern198199---200201## Output Contract202203```typescript204interface MobileCICDOutput {205 ci_pipeline: {206 file_path: string; // e.g., ".github/workflows/mobile-ci.yml"207 format: "yaml";208 platform: "github-actions" | "gitlab-ci";209 jobs: Array<{210 name: string; // e.g., "ios-build", "android-release"211 runner: string; // e.g., "macos-latest", "ubuntu-latest"212 steps: number; // count of CI steps213 }>;214 };215 fastlane_config?: { // optional, iOS-only216 file_path: string; // "fastlane/Fastfile"217 lanes: string[]; // e.g., ["beta", "release"]218 };219 gradle_config?: { // optional, Android-only220 snippet: string; // signing config block for build.gradle221 };222 distribution_setup: {223 platform: string; // "testflight" | "firebase" | "play-internal"224 instructions: string; // markdown setup guide225 required_credentials: string[]; // e.g., ["APP_STORE_CONNECT_API_KEY"]226 };227 secrets_checklist: {228 secrets: Array<{229 name: string; // e.g., "MATCH_PASSWORD"230 description: string;231 required_for: string[]; // e.g., ["ios-beta", "ios-release"]232 }>;233 };234 token_usage: number; // actual tokens consumed235 tier: "T1" | "T2" | "T3";236}237```238239**Required fields:**240241- `ci_pipeline.file_path` and `ci_pipeline.jobs` (always)242- `secrets_checklist.secrets` (if signing or distribution enabled)243- `distribution_setup` (if T2+)244245**Validation:**246247- CI YAML must parse without syntax errors248- Fastfile must use valid Fastlane actions249- Gradle snippet must be syntactically valid Groovy250251---252253## Examples254255**Example 1: React Native app with iOS/Android builds and TestFlight beta**256257**Input:**258```json259{260 "platform": "react-native",261 "ci_platform": "github-actions",262 "distribution": "testflight",263 "signing_method": "fastlane-match",264 "crash_reporting": "sentry"265}266```267268**Output (GitHub Actions excerpt, ≤30 lines):**269270```yaml271name: React Native CI/CD272on: [push, pull_request]273jobs:274 ios-beta:275 runs-on: macos-latest276 steps:277 - uses: actions/checkout@v4278 - uses: actions/setup-node@v4279 - run: npm install280 - name: Install pods281 run: cd ios && pod install282 - name: Fastlane beta283 env:284 MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}285 FASTLANE_USER: ${{ secrets.FASTLANE_USER }}286 FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.APP_SPECIFIC_PASSWORD }}287 run: cd ios && bundle exec fastlane beta288 - name: Upload dSYMs to Sentry289 run: npx sentry-cli upload-dif --org my-org --project my-project ios/build290291 android-beta:292 runs-on: ubuntu-latest293 steps:294 - uses: actions/checkout@v4295 - uses: actions/setup-java@v4296 with: { java-version: '17' }297 - run: npm install298 - name: Build release APK299 env:300 KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}301 run: cd android && ./gradlew assembleRelease302 - name: Upload to Firebase303 run: firebase appdistribution:distribute app/build/outputs/apk/release/app-release.apk --app ${{ secrets.FIREBASE_APP_ID }}304```305306---307308## Quality Gates309310**Token budgets (enforced):**311312- T1 ≤ 2k tokens (build-only)313- T2 ≤ 6k tokens (signing + beta distribution)314- T3 ≤ 12k tokens (release automation + crash reporting)315316**Safety:**317318- Never emit secrets directly in YAML; always use `${{ secrets.SECRET_NAME }}` placeholders319- Validate CI secrets exist before pipeline runs (check CI provider docs)320- Warn if keystore or certificates are stored in version control (security risk)321322**Auditability:**323324- All CI jobs must log build numbers, commit SHAs, and artifact URLs325- Crash reporting symbol uploads must confirm success/failure326- Beta distribution must report uploaded build version and tester group327328**Determinism:**329330- Pin Fastlane versions in Gemfile331- Pin Gradle plugin versions in build.gradle332- Use locked dependency versions (package-lock.json, Gemfile.lock)333334**Performance:**335336- Cache dependencies aggressively (CocoaPods, Gradle, npm)337- Parallelize iOS and Android builds when possible338- Avoid redundant builds (skip CI on docs-only changes)339340---341342## Resources343344**Official Documentation (accessed 2025-10-26T03:51:56-04:00):**345346- [Fastlane Documentation](https://docs.fastlane.tools/) — iOS/Android automation347- [Fastlane Match](https://docs.fastlane.tools/actions/match/) — Code signing sync348- [Android Gradle Plugin](https://developer.android.com/build) — Build configuration349- [GitHub Actions for Xcode](https://docs.github.com/en/actions/deployment/deploying-xcode-applications) — iOS CI setup350- [Firebase App Distribution](https://firebase.google.com/docs/app-distribution) — Beta distribution351- [Sentry Mobile Platforms](https://docs.sentry.io/platforms/react-native/) — Crash reporting352- [Google Play Publishing API](https://developers.google.com/android-publisher) — Android release automation353354**Templates and Tools:**355356- [fastlane/examples](https://github.com/fastlane/examples) — Sample Fastfiles357- [react-native-community/releases](https://github.com/react-native-community/releases) — React Native release tooling358- [CodePush CLI](https://github.com/microsoft/code-push) — Over-the-air updates359360**Best Practices:**361362- Use Fastlane Match for team-based iOS development to avoid certificate conflicts363- Store Android keystores in CI secrets, never commit to version control364- Enable incremental builds and caching to reduce CI duration365- Test beta distributions on real devices before production release366- Monitor crash-free user rates in Sentry/Crashlytics dashboards367368---369370**END OF SKILL**