Ios ci cd
Skill almasumdev/awesome-ios-agent-skills/.github/skills/build_and_tooling/ios-ci-cd
Expert guidance on iOS CI/CD — Xcode Cloud, GitHub Actions on macOS runners, Fastlane lanes, TestFlight delivery, and App Store Connect API automation. Use when setting up pipelines or release automation.From its SKILL.md
npx -y skills add almasumdev/awesome-ios-agent-skills --skill ios-ci-cdAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
6.0 KB, ~1.4k tokens by cl100k_base, as published. Nobody here has run it
iOS CI/CD
Instructions
iOS CI/CD boils down to: build on a macOS host, sign with a managed certificate, test, archive, and ship to App Store Connect. Pick one host (Xcode Cloud or GitHub Actions + Fastlane) and stay consistent.
1. Pick a Host
| Host | Pros | Cons |
|---|---|---|
| Xcode Cloud | Native, zero infra, automatic signing, TestFlight wired. | Vendor lock-in, limited customization. |
| GitHub Actions | Full control, shared secrets with other pipelines. | You own the macOS runner config. |
| Bitrise / Codemagic | Good iOS ergonomics, prebuilt steps. | Extra vendor. |
2. GitHub Actions: Build & Test
name: iOS CI
on:
pull_request:
push:
branches: [main]
jobs:
test:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.4'
- name: Resolve SPM
run: xcodebuild -resolvePackageDependencies -workspace MyApp.xcworkspace -scheme MyApp
- name: Test
run: |
xcodebuild test \
-workspace MyApp.xcworkspace \
-scheme MyApp \
-destination 'platform=iOS Simulator,name=iPhone 15' \
-resultBundlePath build/Tests.xcresult \
-parallel-testing-enabled YES
- uses: actions/upload-artifact@v4
if: always()
with:
name: xcresult
path: build/Tests.xcresult
3. Fastlane Lanes
Install via bundle init, add fastlane to the Gemfile. Keep lanes small and composable:
# fastlane/Fastfile
default_platform(:ios)
platform :ios do
desc "Run unit + UI tests"
lane :test do
run_tests(
workspace: "MyApp.xcworkspace",
scheme: "MyApp",
devices: ["iPhone 15"],
result_bundle: true,
code_coverage: true
)
end
desc "Build and upload to TestFlight"
lane :beta do
setup_ci if ENV["CI"]
match(type: "appstore", readonly: true)
increment_build_number(xcodeproj: "MyApp.xcodeproj")
build_app(
workspace: "MyApp.xcworkspace",
scheme: "MyApp",
export_method: "app-store",
configuration: "Release"
)
upload_to_testflight(
skip_waiting_for_build_processing: true,
api_key_path: "fastlane/app_store_connect_api_key.json"
)
end
end
4. Signing with match
match stores your team's distribution certificate and provisioning profiles encrypted in a private git repo. On CI:
bundle exec fastlane match appstore --readonly
CI needs the MATCH_PASSWORD secret and an SSH deploy key (or HTTPS token) for the match repo.
5. App Store Connect API Key
Generate a key in App Store Connect → Users and Access → Keys. Store .p8 content as a CI secret. Build the JSON fastlane expects:
{
"key_id": "XXXXXXXXXX",
"issuer_id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----",
"in_house": false
}
Used by upload_to_testflight, pilot, deliver, precheck.
6. TestFlight Delivery Pipeline
beta:
needs: test
runs-on: macos-14
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with: { ruby-version: '3.3', bundler-cache: true }
- name: Write API Key
run: echo "$ASC_API_KEY_JSON" > fastlane/app_store_connect_api_key.json
env: { ASC_API_KEY_JSON: ${{ secrets.ASC_API_KEY_JSON }} }
- name: Beta
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
run: bundle exec fastlane beta
7. Xcode Cloud
If you prefer Apple's hosted offering:
-
Enable Xcode Cloud in App Store Connect.
-
Add
ci_scripts/ci_post_clone.shfor any pre-build setup:#!/bin/sh set -euo pipefail brew install swiftlint -
Define workflows in Xcode (Report Navigator → Cloud). Workflows map branches to start actions: Build, Test, Archive, TestFlight, App Store.
Xcode Cloud handles signing automatically with your team's Apple Developer account.
8. Store Submission
Automate metadata and screenshots:
lane :release do
deliver(
submit_for_review: true,
automatic_release: false,
force: true,
precheck_include_in_app_purchases: false,
api_key_path: "fastlane/app_store_connect_api_key.json"
)
end
Keep screenshots in fastlane/screenshots/<locale>/ regenerated by snapshot on a nightly schedule.
9. Quality Gates
Block merges to main on:
- Unit + UI tests passing.
- SwiftLint / SwiftFormat clean.
Package.resolvedunchanged or PR-reviewed.- No increase in app-binary size beyond a budget (
actions-app-size-reportor similar).
10. Monitoring Releases
- Wire Crashlytics or Apple's own crash reports to a Slack channel.
- Track KPIs (crash-free sessions, launch time, cold-start p95) per release — regressions should block the next rollout.
Checklist
- One CI host owns iOS builds; no duplicated pipelines.
- Signing identities managed by
matchor Xcode Cloud, never checked in. - App Store Connect API key stored as an encrypted CI secret.
-
fastlane betaruns onmainand uploads to TestFlight. - Build numbers auto-increment; versions bump via PR.
- Test and snapshot artifacts are uploaded from CI.
- Store submission has a reviewed
releaselane; metadata lives infastlane/.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.