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 cito install JS dependencies deterministically. - Android:
cd android && ./gradlew assembleRelease. - iOS:
cd ios && pod installthenxcodebuild ... archiveon 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 buildGotchas
- 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
How to Cache Gradle and CocoaPods in CISpeed up mobile CI by caching the Gradle home and the CocoaPods Pods directory keyed on the lockfiles, so dep…
How to Build a Flutter App in CI (APK, App Bundle, IPA)Build a Flutter app in CI with flutter build apk, appbundle, and ipa after setting up the Flutter SDK via sub…