Continuous Integration and Continuous Deployment (CI/CD) automate building, testing, and deploying React Native apps. Below is a step-by-step guide to setting up CI/CD using GitHub Actions, Fastlane, and cloud services like EAS, Bitrise, or App Center.
You can set up CI/CD using:
CI/CD Tool | Platform | Best For |
---|---|---|
GitHub Actions | Free for GitHub projects | Custom pipelines |
Bitrise | Android & iOS | No need for macOS |
EAS (Expo) | Expo apps | Easiest setup |
App Center | Android & iOS | Microsoft ecosystem |
Fastlane | Android & iOS | Advanced automation |
GitHub Actions is a free way to automate builds and tests.
.github/workflows/ci.yml
FileInside your React Native project, create the following CI/CD workflow:
name: React Native CI/CD
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-android:
name: Build Android APK
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Dependencies
run: npm install
- name: Build Android APK
run: cd android && ./gradlew assembleRelease
- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: app-release.apk
path: android/app/build/outputs/apk/release/app-release.apk
build-ios:
name: Build iOS IPA
runs-on: macos-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install Dependencies
run: npm install
- name: Install CocoaPods
run: cd ios && pod install
- name: Build iOS App
run: xcodebuild -workspace ios/App.xcworkspace -scheme App -sdk iphoneos -configuration Release archive -archivePath ios/build/App.xcarchive
- name: Upload IPA
uses: actions/upload-artifact@v3
with:
name: app-release.ipa
path: ios/build/App.xcarchive
* This workflow :
main
Fastlane helps deploy your app to Google Play Store and App Store.
npm install -g fastlane
cd android
fastlane init
Then, create android/fastlane/Fastfile
with:
platform :android do
desc "Build and upload APK to Play Store"
lane :deploy do
gradle(task: "assembleRelease")
upload_to_play_store(track: "production")
end
end
Run:
fastlane android deploy
cd ios
fastlane init
Modify ios/fastlane/Fastfile
:
platform :ios do
desc "Build and upload IPA to App Store"
lane :deploy do
gym(scheme: "App")
upload_to_app_store
end
end
Run:
fastlane ios deploy
* Fastlane automates signing, building, and uploading your app!
npm install -g eas-cli
eas login
eas build:configure
eas build -p android
eas submit -p android
* This uploads the app directly to the Play Store/App Store!
Bitrise is a cloud-based CI/CD tool for React Native.
* Great for teams that don’t have macOS!
Tool | Setup Time | Best For |
---|---|---|
GitHub Actions | Medium | Free, custom builds |
Fastlane | Medium | Play Store/App Store uploads |
EAS (Expo) | Easy | Expo apps |
Bitrise | Easy | No Mac needed |
App Center | Medium | Microsoft ecosystem |