乐闻世界logo
搜索文章和话题

What is the deployment and release process for Expo apps? How to use EAS Build?

2月21日 15:16

The deployment and release process of Expo apps is the final step in the development cycle and a key link to ensure successful app launch. Expo provides multiple deployment options, with comprehensive tool support from development testing to production release.

Deployment Process Overview:

  1. Development Phase: Use Expo Go for rapid iteration
  2. Testing Phase: Use Development Build for real device testing
  3. Pre-release Phase: Use EAS Build to generate test versions
  4. Production Phase: Use EAS Build and Submit to publish to app stores

EAS Build Deployment:

  1. Configure EAS
bash
# Install EAS CLI npm install -g eas-cli # Login to Expo account eas login # Configure project eas build:configure
  1. Configure eas.json
json
{ "cli": { "version": ">= 5.2.0" }, "build": { "development": { "developmentClient": true, "distribution": "internal", "android": { "buildType": "apk" }, "ios": { "simulator": false } }, "preview": { "distribution": "internal", "android": { "buildType": "apk" }, "ios": { "simulator": true } }, "production": { "android": { "buildType": "app-bundle" }, "ios": { "autoIncrement": true } } }, "submit": { "production": { "android": { "serviceAccountKeyPath": "./google-service-account.json", "track": "internal" }, "ios": { "appleId": "your-apple-id@email.com", "ascAppId": "YOUR_APP_STORE_CONNECT_APP_ID", "appleTeamId": "YOUR_TEAM_ID", "skipWorkflow": false } } } }
  1. Build App
bash
# Build development version eas build --profile development --platform android # Build preview version eas build --profile preview --platform ios # Build production version eas build --profile production --platform android # Local build eas build --local --platform android

Android Deployment:

  1. Prepare Google Play Account
bash
# Create Google Play Developer account # Visit https://play.google.com/console
  1. Configure Google Play Service Account
bash
# Create service account # 1. Visit Google Play Console # 2. Go to Settings > API access # 3. Create service account # 4. Download JSON key file # 5. Grant service account permissions
  1. Submit to Google Play
bash
# Submit app eas submit --platform android --latest # Submit specific build eas submit --platform android --build-id BUILD_ID # Specify release track eas submit --platform android --track internal
  1. Google Play Release Tracks
  • Internal: Internal testing (up to 100 testers)
  • Alpha: Closed testing (unlimited)
  • Beta: Open testing
  • Production: Official release

iOS Deployment:

  1. Prepare Apple Developer Account
bash
# Register for Apple Developer Program # Visit https://developer.apple.com/programs/
  1. Configure Certificates and Provisioning Profiles
bash
# Use EAS to automatically manage certificates # Or manually configure: # 1. Create App ID # 2. Create development certificate # 3. Create distribution certificate # 4. Create provisioning profile
  1. Configure app.json
json
{ "expo": { "ios": { "bundleIdentifier": "com.yourcompany.yourapp", "buildNumber": "1", "supportsTablet": true, "infoPlist": { "NSCameraUsageDescription": "Need camera permission", "NSLocationWhenInUseUsageDescription": "Need location permission" } } } }
  1. Submit to App Store
bash
# Submit app eas submit --platform ios --latest # Use TestFlight for testing # 1. Upload to App Store Connect # 2. Add testers # 3. Distribute TestFlight version

OTA Update Deployment:

  1. Configure Updates
json
{ "expo": { "updates": { "url": "https://u.expo.dev/your-project-id" }, "runtimeVersion": { "policy": "appVersion" } } }
  1. Publish Updates
bash
# Create update eas update --branch production --message "Fix bug" # View update history eas update:list # Rollback update eas update:rollback --branch production

Web Deployment:

  1. Build Web Version
bash
# Build production version npx expo export:web # Local preview npx expo start --web
  1. Deploy to Vercel
bash
# Install Vercel CLI npm i -g vercel # Deploy vercel # Production deployment vercel --prod
  1. Deploy to Netlify
bash
# Install Netlify CLI npm i -g netlify-cli # Deploy netlify deploy --prod

Environment Variable Management:

  1. Configure Environment Variables
bash
# Set EAS environment variables eas secret:create --name API_KEY --value "your-api-key" # View environment variables eas secret:list # Delete environment variable eas secret:delete --name API_KEY
  1. Use in Code
typescript
// Access environment variables const API_KEY = process.env.EXPO_PUBLIC_API_KEY; const API_URL = process.env.EXPO_PUBLIC_API_URL;

Version Management:

  1. Version Number Convention
json
{ "expo": { "version": "1.0.0", "ios": { "buildNumber": "1" }, "android": { "versionCode": 1 } } }
  1. Automated Version Management
bash
# Use semantic-release npm install --save-dev semantic-release # Configure .releaserc.json { "branches": ["main"], "plugins": [ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", "@semantic-release/npm", "@semantic-release/github" ] }

CI/CD Integration:

  1. GitHub Actions Configuration
yaml
name: Build and Deploy on: push: branches: [main] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: node-version: '18' - run: npm ci - run: npm test - run: eas build --platform android --non-interactive env: EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
  1. Automated Testing and Deployment
yaml
name: CI/CD Pipeline on: push: branches: [main, develop] pull_request: branches: [main] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - run: npm ci - run: npm test build-android: needs: test runs-on: ubuntu-latest if: github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v2 - run: eas build --platform android --non-interactive env: EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }} build-ios: needs: test runs-on: ubuntu-latest if: github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v2 - run: eas build --platform ios --non-interactive env: EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}

Best Practices:

  1. Version Control: Use semantic versioning
  2. Automated Testing: Run all tests before deployment
  3. Gradual Release: Release to test tracks first, then production
  4. Monitoring and Logging: Monitor app performance and errors after deployment
  5. Rollback Plan: Prepare quick rollback plan
  6. Documentation: Record content and changes of each release

Common Issues:

  1. Build Failures: Check configuration files and dependency versions
  2. Submission Rejections: Ensure compliance with app store review guidelines
  3. Updates Not Taking Effect: Check runtime version and update configuration
  4. Signing Issues: Ensure certificates and provisioning profiles are correctly configured

Through a comprehensive deployment process, you can ensure Expo apps launch successfully and run stably.

标签:Expo