Skip to content
Latchkey

How to Build a React Native App in CI (Android and iOS)

A bare React Native build is a JS install plus the native Gradle (Android) and xcodebuild/CocoaPods (iOS) steps.

Install JS deps with npm ci, then build each platform natively. Android runs on Linux with Gradle; iOS runs on macOS after pod install in the ios directory.

Steps

  • Run npm ci to install JS dependencies deterministically.
  • Android: cd android && ./gradlew assembleRelease.
  • iOS: cd ios && pod install then xcodebuild ... archive on macOS.

Workflow

.github/workflows/ci.yml
jobs:
  android:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: npm
      - run: npm ci
      - run: cd android && ./gradlew assembleRelease
  ios:
    runs-on: macos-14
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
      - run: npm ci
      - run: cd ios && pod install
      - run: xcodebuild -workspace ios/MyApp.xcworkspace -scheme MyApp -sdk iphonesimulator build

Gotchas

  • Keep the CocoaPods repo and node_modules cached; a cold RN build is slow.
  • The iOS and Android jobs run on different OS images, so split them into separate jobs.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →