Mobile App Release & CI/CD
This guide covers the complete CI/CD pipeline for the PersiaNation mobile application, including automated builds, testing, and deployment processes using Expo Application Services (EAS) and GitHub Actions.
Overview
Section titled “Overview”The PersiaNation mobile app uses a sophisticated CI/CD pipeline that includes:
- Automated Testing: Type checking, linting, and E2E tests
- Multi-Environment Builds: Development, staging, and production builds
- Over-The-Air (OTA) Updates: JavaScript and asset updates without app store submissions
- Automated Releases: GitHub releases with automatic version management
- Store Deployment: Automated submission to iOS App Store and Google Play Store
Build Environments
Section titled “Build Environments”The app supports multiple build environments configured in eas.json:
Development
Section titled “Development”- Purpose: Local development and testing
- Distribution: Internal
- Features: Development client enabled, simulator support
- Channel:
development
Staging
Section titled “Staging”- Purpose: Pre-production testing and QA
- Distribution: Internal
- Features: Internal distribution for testing
- Channel:
staging - Store Submission: Draft releases to internal testing tracks
Production
Section titled “Production”- Purpose: Production app store releases
- Distribution: Store
- Features: Optimized builds for app stores
- Channel:
production - Store Submission: Full app store releases
GitHub Actions Workflows
Section titled “GitHub Actions Workflows”1. Automated Testing (test.yml, lint-ts.yml, type-check.yml)
Section titled “1. Automated Testing (test.yml, lint-ts.yml, type-check.yml)”Runs on every push and pull request:
# Triggered on: push, pull_request- Type checking with TypeScript- ESLint code quality checks- Unit and integration tests- E2E testing on Android2. Preview Builds (preview.yml)
Section titled “2. Preview Builds (preview.yml)”Triggers on hotfix branches:
# Triggered on: push/PR to hotfix branch- Creates EAS Update for quick testing- Posts preview link in PR comments- Uses staging channel for testing3. GitHub Release (new-github-release.yml)
Section titled “3. GitHub Release (new-github-release.yml)”Automatically creates GitHub releases:
# Triggered on: git tag push- Creates draft GitHub release- Generates release notes automatically- Links to build artifactsEAS Build Configuration
Section titled “EAS Build Configuration”Build Profiles
Section titled “Build Profiles”The eas.json configuration defines three main build profiles:
{ "build": { "production": { "channel": "production", "distribution": "store", "android": { "buildType": "app-bundle" }, "env": { "APP_ENV": "production" } }, "staging": { "channel": "staging", "distribution": "internal", "env": { "APP_ENV": "staging" } }, "development": { "channel": "development", "developmentClient": true, "distribution": "internal", "env": { "APP_ENV": "development" } } }}Building the App
Section titled “Building the App”Manual Builds
Section titled “Manual Builds”# Build for different environmentseas build --platform all --profile productioneas build --platform all --profile stagingeas build --platform all --profile development
# Platform-specific buildseas build --platform ios --profile productioneas build --platform android --profile stagingAutomated Builds
Section titled “Automated Builds”Builds are automatically triggered by:
- Git tags: Production builds for releases
- Push to staging: Staging builds for testing
- Pull requests: Development builds for review
Over-The-Air (OTA) Updates
Section titled “Over-The-Air (OTA) Updates”OTA Update Strategy
Section titled “OTA Update Strategy”OTA updates allow pushing JavaScript and asset changes without app store approval:
# Deploy OTA update to stagingeas update --branch staging-branch --message "Fix login issue"
# Deploy OTA update to productioneas update --branch production-branch --message "Add new feature"
# Auto-deploy (used in CI/CD)eas update --autoChannel Management
Section titled “Channel Management”- production: Live app users receive these updates
- staging: Internal testing and QA
- development: Developer testing and debugging
Update Workflow
Section titled “Update Workflow”- Code Changes: Make JavaScript/asset changes
- Testing: Test locally and in development
- Staging Deploy:
eas update --branch staging-branch - QA Approval: Test on staging channel
- Production Deploy:
eas update --branch production-branch
Release Process
Section titled “Release Process”1. Version Management
Section titled “1. Version Management”Version numbers are managed in:
app.config.ts: App version and build numberpackage.json: Package version- Environment variables: Runtime version
export default { version: Env.VERSION, // e.g., "1.2.3" ios: { buildNumber: Env.BUILD_NUMBER, // e.g., "123" }, android: { versionCode: parseInt(Env.BUILD_NUMBER), // e.g., 123 },};2. Release Workflow
Section titled “2. Release Workflow”Automated Release (Recommended)
Section titled “Automated Release (Recommended)”-
Create Release Branch:
Terminal window git checkout -b release/v1.2.3 -
Update Version Numbers:
Terminal window # Update package.json, app.config.ts, etc.npm version 1.2.3 -
Push and Tag:
Terminal window git push origin release/v1.2.3git tag v1.2.3git push origin v1.2.3 -
Automated Process:
- GitHub Actions detects tag
- Builds production app
- Creates GitHub release
- Submits to app stores (if configured)
Manual Release
Section titled “Manual Release”-
Build Production App:
Terminal window eas build --platform all --profile production -
Submit to Stores:
Terminal window eas submit --platform all --profile production -
Create GitHub Release:
Terminal window gh release create v1.2.3 --title "Release v1.2.3" --notes "Release notes"
3. Store Submission
Section titled “3. Store Submission”iOS App Store
Section titled “iOS App Store”# Automatic submissioneas submit --platform ios --profile production
# Manual submission via App Store Connect# - Upload build via Xcode or Transporter# - Configure app metadata# - Submit for reviewGoogle Play Store
Section titled “Google Play Store”# Automatic submission to internal trackeas submit --platform android --profile staging
# Production releaseeas submit --platform android --profile productionEnvironment Variables & Secrets
Section titled “Environment Variables & Secrets”Required GitHub Secrets
Section titled “Required GitHub Secrets”EXPO_TOKEN # Expo account token for EAS operationsGOOGLE_SERVICES_JSON # Android Google Services configurationAPPLE_TEAM_ID # iOS development team IDEnvironment Configuration
Section titled “Environment Configuration”# DevelopmentAPP_ENV=developmentBASE_API_URL=https://dev-api.example.com
# StagingAPP_ENV=stagingBASE_API_URL=https://staging-api.example.com
# ProductionAPP_ENV=productionBASE_API_URL=https://api.example.comMonitoring & Analytics
Section titled “Monitoring & Analytics”Build Monitoring
Section titled “Build Monitoring”- EAS Dashboard: Monitor build status and logs
- GitHub Actions: View workflow execution and failures
- Expo Updates: Track OTA update adoption
Release Analytics
Section titled “Release Analytics”- App Store Connect: iOS download and crash analytics
- Google Play Console: Android metrics and performance
- Expo Analytics: User engagement and update metrics
Troubleshooting
Section titled “Troubleshooting”Common Build Issues
Section titled “Common Build Issues”Build Failures
Section titled “Build Failures”# Clear cache and retryeas build --clear-cache --platform all --profile production
# Check build logs in EAS dashboardeas build:list --status=erroredOTA Update Issues
Section titled “OTA Update Issues”# Verify channel configurationeas channel:list
# Check update deploymenteas update:list --branch production-branch
# Rollback problematic updateeas update:rollback --branch production-branch --group-id <group-id>Store Submission Issues
Section titled “Store Submission Issues”# Check submission statuseas submit:list
# Retry failed submissioneas submit --platform ios --profile production --latestDebug Commands
Section titled “Debug Commands”# View build detailseas build:view <build-id>
# Check project configurationeas config
# Validate eas.jsoneas build:configure
# View update historyeas update:list --branch <branch-name>Best Practices
Section titled “Best Practices”1. Version Management
Section titled “1. Version Management”- Use semantic versioning (1.2.3)
- Increment build numbers for each build
- Tag releases in git for traceability
2. Testing Strategy
Section titled “2. Testing Strategy”- Run full test suite before releases
- Use staging environment for QA
- Test OTA updates on staging first
3. Release Planning
Section titled “3. Release Planning”- Schedule releases during low-traffic periods
- Prepare rollback plans for major releases
- Monitor crash reports after releases
4. Security
Section titled “4. Security”- Rotate Expo tokens regularly
- Use separate credentials for different environments
- Never commit sensitive data to git
Related Documentation
Section titled “Related Documentation”- Mobile App Installation: Setup and development environment
- OTA Updates Guide: Detailed OTA update procedures
- EAS Documentation: Official Expo documentation
- GitHub Actions: GitHub automation documentation