React Native iOS CI belongs on an Apple silicon Mac, so Metro, Hermes and the iOS Simulator run arm64 natively and the archive step uses a current Xcode. Register the Mac as a GitHub self-hosted runner, pin Node and Ruby, sign with Fastlane Match in read-only mode, and upload to TestFlight with a Fastlane lane. The workflow and Fastfile below do all of that.
What does the React Native iOS build chain involve?
Three ecosystems run in a fixed order: Node (Metro, Hermes), then Ruby with CocoaPods (native pods declared by npm packages), then Xcode (archive and sign). Skip or reorder a step and the error surfaces in the next layer. A missing Node yields a Metro error, a skipped pod install yields an Xcode "module not found," and a missing scheme yields an xcodebuild exit code. Apple's xcodebuild technote TN2339 documents the -workspace, -scheme and -archivePath arguments the workflow uses, and React Native's Running on device guide covers the iOS workspace and signing prerequisites.
How do I pin Node and Ruby?
Pin both runtimes explicitly, because toolchain drift is the biggest source of flaky iOS CI:
- Node:
actions/setup-nodewith a specific major (Node 20 LTS is a safe default; defer topackage.jsonengineswhen it exists).cache: 'npm'caches the npm download index keyed onpackage-lock.json;npm cistill populatesnode_modules. - Ruby:
ruby/setup-rubywithbundler-cache: true. This cachesvendor/bundlekeyed onGemfile.lock, which should pin both CocoaPods and Fastlane. Avoidsudo gem install, because the bundler cache is faster and reproducible.
Cache node_modules and ios/Pods with separate keys so an npm change does not invalidate your Pods cache. Key the Pods cache on ios/Podfile.lock, the precise record of resolved Pod versions.
Which scheme do I archive, and how does signing work?
Archive the workspace, never the bare .xcodeproj, because CocoaPods produces ios/YourApp.xcworkspace. Find the real scheme on your own machine first instead of guessing it in CI:
xcodebuild -list -workspace ios/YourApp.xcworkspace
Copy the exact scheme into Fastlane's build_app call. Use Fastlane Match with --readonly in CI so a pull request build never tries to create new certificates, which would fail without interactive auth and can disturb your signing pool. Match stores encrypted certificates and provisioning profiles in a private git repo, and the runner pulls them under a temporary keychain that Match manages for the job. Keep the .p8 App Store Connect key, the Match encryption password and the Match git token in your CI secret manager. Never check them into the repo, and never dump the shell environment to a file.
What do the workflow and Fastfile look like?
Replace YourApp with your actual scheme. Register your Figment Mac as a self-hosted runner and label it mac-arm64; adjust runs-on to match.
# .github/workflows/ios-ci.yml
name: React Native iOS CI
on:
push:
branches: [main, 'release/**']
pull_request:
branches: [main]
jobs:
build-ios:
runs-on: [self-hosted, mac-arm64]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci --prefer-offline
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- uses: actions/cache@v4
with:
path: ios/Pods
key: pods-${{ runner.os }}-${{ hashFiles('ios/Podfile.lock') }}
restore-keys: pods-${{ runner.os }}-
- name: Install CocoaPods
working-directory: ios
run: bundle exec pod install
- name: Sync signing material (read-only)
run: bundle exec fastlane match appstore --readonly
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
- name: Archive and upload to TestFlight
run: bundle exec fastlane beta
env:
APP_STORE_CONNECT_API_KEY_ID: ${{ secrets.ASC_KEY_ID }}
APP_STORE_CONNECT_API_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}
APP_STORE_CONNECT_API_KEY_CONTENT: ${{ secrets.ASC_PRIVATE_KEY }}
The matching fastlane/Fastfile (see the Fastlane iOS beta deployment guide for the primary reference):
default_platform(:ios)
platform :ios do
lane :beta do
app_store_connect_api_key(
key_id: ENV.fetch("APP_STORE_CONNECT_API_KEY_ID"),
issuer_id: ENV.fetch("APP_STORE_CONNECT_API_ISSUER_ID"),
key_content: ENV.fetch("APP_STORE_CONNECT_API_KEY_CONTENT"),
is_key_content_base64: true
)
build_app(
workspace: "ios/YourApp.xcworkspace",
scheme: "YourApp",
configuration: "Release",
export_method: "app-store"
)
upload_to_testflight(skip_waiting_for_build_processing: true)
end
end
Steps return non-zero on failure and GitHub Actions stops the job, so a failed archive is a failed run, never a fast one. Run the workflow once on a feature branch so you read the first log without release-week pressure. The first runs populate the npm and CocoaPods caches, and later runs reuse them.
Provision these five repository secrets before the first run:
| Secret | Contents |
|---|---|
MATCH_PASSWORD | Encryption password for the Match git repo |
MATCH_GIT_BASIC_AUTHORIZATION | Base64 user:token for Match git access |
ASC_KEY_ID | App Store Connect API key ID |
ASC_ISSUER_ID | App Store Connect issuer UUID |
ASC_PRIVATE_KEY | Base64-encoded .p8 key content |
How do I confirm the runner is arm64?
Run these once the runner is provisioned:
uname -m # expect arm64
node -e "console.log(process.arch)" # expect 'arm64'
xcodebuild -version
Which Figment Mac plan fits React Native iOS CI?
Use the Apple Silicon Mac VM ($0.40 an hour, $6 a day, $39 a month; 4 shared vCPUs, 4GB RAM, 65GB SSD) for a single runner on current Xcode. Move to the Dedicated M4 Pro 48 GB ($349 a month; M4 Pro, 48GB RAM, 512GB SSD) for parallel builds or heavy archives. The Intel Mac VM ($25 a month) runs macOS Sequoia and cannot run arm64-only binaries, so it does not fit this pipeline. Check the macOS version shown before purchase against Apple's Xcode table. Figment runs the Mac; you manage the runner, Fastlane, signing and your Apple account.
For a price check on a single arm64 runner, CloudMac lists an M4 with 16GB and 256GB at $99.99 a month, and a $999 a year option on cloudmac.org, which is $83.25 a month. Twelve months of the Apple Silicon Mac VM is 12 × $39 = $468, which is $531 less than $999 and $731.88 less than 12 × $99.99 = $1,199.88. The Dedicated M4 Pro 48 GB at $3,228 a year paid up front costs more than either CloudMac option, with 48GB RAM and a 512GB SSD against 16GB and 256GB. Compare the hardware as well as the price: the VM has less memory than the CloudMac listing and is a VM with shared vCPUs.
Related guides: Build Flutter iOS in CI on a Mac runner · Send Slack alerts for iOS CI build status · Remote Xcode setup on Windows