Skip to content

Automated TestFlight Deployment

Apple's CI/CD service - builds and uploads automatically on git push.

# Install fastlane
brew install fastlane

# Initialize in project
cd ios/Nutri-E
fastlane init

# Create Fastfile
fastlane/Fastfile:
default_platform(:ios)

platform :ios do
  desc "Push to TestFlight"
  lane :beta do
    increment_build_number
    build_app(scheme: "Nutri-E")
    upload_to_testflight
  end
end
# Run deployment
fastlane beta

Method 3: GitHub Actions

.github/workflows/testflight.yml:

name: Deploy to TestFlight
on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v3
      - name: Build and Upload
        env:
          APP_STORE_CONNECT_API_KEY: ${{ secrets.API_KEY }}
        run: |
          xcodebuild archive -scheme Nutri-E -archivePath app.xcarchive
          xcodebuild -exportArchive -archivePath app.xcarchive -exportOptionsPlist ExportOptions.plist -exportPath .
          xcrun altool --upload-app -f Nutri-E.ipa --apiKey $APP_STORE_CONNECT_API_KEY

Method 4: App Store Connect API Key (For Terminal)

  1. Create API key at https://appstoreconnect.apple.com/access/api
  2. Download the .p8 file
  3. Store credentials:
# Create API key config
mkdir -p ~/.appstoreconnect/private_keys
cp AuthKey_XXXXXXXXXX.p8 ~/.appstoreconnect/private_keys/

# Export with API key
xcodebuild -exportArchive \
  -archivePath ~/Desktop/Nutri-E.xcarchive \
  -exportOptionsPlist ExportOptions.plist \
  -exportPath ~/Desktop \
  -allowProvisioningUpdates \
  -authenticationKeyPath ~/.appstoreconnect/private_keys/AuthKey_XXXXXXXXXX.p8 \
  -authenticationKeyID XXXXXXXXXX \
  -authenticationKeyIssuerID XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

Method 5: xcrun altool with App-Specific Password

  1. Generate app-specific password at https://appleid.apple.com/account/manage
  2. Store in keychain:
xcrun altool --store-password-in-keychain-item "AC_PASSWORD" \
  -u your-apple-id@example.com \
  -p app-specific-password

# Then upload
xcrun altool --upload-app \
  -f ~/Desktop/Nutri-E.ipa \
  -u your-apple-id@example.com \
  -p @keychain:AC_PASSWORD

Method 6: Simple Bash Script

deploy.sh:

#!/bin/bash

# Increment build number
agvtool next-version -all

# Archive
xcodebuild -project Nutri-E.xcodeproj \
  -scheme Nutri-E \
  -destination 'generic/platform=iOS' \
  -archivePath build/Nutri-E.xcarchive \
  archive

# Export
xcodebuild -exportArchive \
  -archivePath build/Nutri-E.xcarchive \
  -exportOptionsPlist ExportOptions.plist \
  -exportPath build

# Upload (requires API key setup)
xcrun altool --upload-app -f build/Nutri-E.ipa \
  --apiKey YOUR_KEY_ID \
  --apiIssuer YOUR_ISSUER_ID

echo "✅ Deployed to TestFlight!"

  • Most mature and widely used
  • Handles certificates automatically
  • Great documentation
  • Can automate screenshots, metadata, etc.

Quick Start with Fastlane:

brew install fastlane
cd ios/Nutri-E
fastlane init  # Choose option 2 for TestFlight
fastlane beta  # Runs the deployment