Lesson 6 of 11
GitHub Actions CI/CD Pipeline
A CI/CD pipeline runs tests, type checks, and builds automatically on every push or pull request. For React Native with EAS, GitHub Actions triggers EAS Build and EAS Submit - delivering a store-ready binary from a single git push.
.github/workflows/ci.yml
name: CI - Lint, Type Check & Test
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
quality:
name: Lint, Types & Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: TypeScript type check
run: npx tsc --noEmit
- name: Unit tests
run: npm test -- --ci --coverage --coverageReporters=lcov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/lcov.info.github/workflows/deploy.yml
name: Deploy - EAS Build & Submit
on:
push:
branches: [main] # trigger on merge to main only
workflow_dispatch: # allow manual trigger from GitHub UI
inputs:
platform:
description: 'Platform to build'
required: true
default: 'all'
type: choice
options: [all, ios, android]
env:
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }} # from expo.dev → Access Tokens
jobs:
build-and-submit:
name: EAS Build & Submit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: Run quality checks
run: |
npm run lint
npx tsc --noEmit
npm test -- --ci
- name: EAS Build (production)
run: |
eas build --platform ${{ inputs.platform || 'all' }} \
--profile production \
--non-interactive \
--no-wait # submit build jobs and don't wait in CI
- name: Notify Slack on success
if: success()
uses: 8398a7/action-slack@v3
with:
status: success
text: '✅ Production build submitted to EAS!'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
- name: Notify Slack on failure
if: failure()
uses: 8398a7/action-slack@v3
with:
status: failure
text: '❌ Production build failed!'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
# Secrets needed in GitHub repo settings:
# EXPO_TOKEN: expo.dev → Access Tokens → Create
# SLACK_WEBHOOK: Slack app Incoming Webhook URL
# CODECOV_TOKEN: codecov.io → Project settings → TokenOTA Update on Merge
# .github/workflows/ota-update.yml
# Publish an OTA update immediately on merge to main
# (skips App Store/Play Store - for JS-only changes)
name: OTA Update
on:
push:
branches: [main]
paths:
- 'src/**' # only trigger for JS source changes
- 'assets/**'
- '!android/**' # NOT for native code changes
- '!ios/**'
jobs:
ota:
name: Publish EAS Update
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: '20', cache: 'npm' }
- run: npm ci
- uses: expo/expo-github-action@v8
with: { eas-version: latest, token: ${{ secrets.EXPO_TOKEN }} }
- name: Publish update
run: |
eas update \
--channel production \
--message "Release ${{ github.sha }}: ${{ github.event.head_commit.message }}" \
--non-interactiveTip
Tip
Practice GitHub Actions CICD Pipeline in small, isolated examples before integrating into larger projects. Breaking concepts into small experiments builds genuine understanding faster than reading alone.
Automated continuous integration and deployment on every Git push
Practice Task
Note
Practice Task - (1) Write a working example of GitHub Actions CICD Pipeline from scratch without looking at notes. (2) Modify it to handle an edge case (empty input, null value, or error state). (3) Share your solution in the Priygop community for feedback.
Quick Quiz
Common Mistake
Warning
A common mistake with GitHub Actions CICD Pipeline is skipping edge case testing - empty inputs, null values, and unexpected data types. Always validate boundary conditions to write robust, production-ready react native code.
Finished this lesson?