The Time Manual Beta Distribution Eats
Archive, upload, invite testers — repeat after every single change. That manual TestFlight loop eats more time than you'd expect, and it's where small mistakes creep in: a missed invite, a mis-numbered build. TestFlight itself is excellent; the path leading up to it is what's begging to be automated.
In this guide, you'll learn how to use Antigravity's AI agent capabilities alongside Fastlane and GitHub Actions to build a fully automated TestFlight distribution pipeline.
By the end of this article, you'll be able to:
- Set up Fastlane quickly with Antigravity's assistance
- Automatically upload builds to TestFlight on every push to a release branch
- Automate tester management and notifications so you can focus on writing code
Who this is for: iOS developers with CI/CD basics under their belt, and some familiarity with the Antigravity IDE.
Prerequisites
Before getting started, make sure you have the following ready:
- macOS with Xcode 16 or later installed
- A paid Apple Developer account
- An app already registered in App Store Connect
- Antigravity IDE (latest version) installed
- Ruby 3.0 or later (required to run Fastlane)
- A GitHub account and repository
Once your environment is set, open your project in Antigravity. Understanding the full pipeline before diving in will save you a lot of debugging time later.
How the Pipeline Works
The automated distribution pipeline runs in the following sequence:
- A developer pushes code to
mainor arelease/*branch - GitHub Actions triggers a macOS runner and starts the build
- Fastlane's
betalane handles archiving, code signing, and uploading - The build appears in TestFlight and testers are notified automatically
Throughout this process, Antigravity's AI agent assists with generating configuration files, diagnosing build errors, and suggesting improvements — dramatically reducing the manual overhead.
Step 1: Set Up Fastlane
Install Fastlane
Open the terminal panel in Antigravity and run the following:
# Use a Gemfile to install Fastlane
bundle init
echo 'gem "fastlane"' >> Gemfile
bundle install
# Initialize Fastlane
bundle exec fastlane initAfter installation, you can ask Antigravity to generate your Fastfile directly in the chat:
Example prompt to Antigravity:
"Create a Fastfile for automated TestFlight distribution.
App name: MyApp, Bundle ID: com.example.myapp, Team ID: ABC12345"
Here's an example of the Fastfile Antigravity might generate:
# fastlane/Fastfile
default_platform(:ios)
platform :ios do
desc "Upload a beta build to TestFlight"
lane :beta do
# Sync certificates and provisioning profiles
match(type: "appstore")
# Auto-increment build number
increment_build_number(
build_number: latest_testflight_build_number + 1
)
# Archive and export the app
gym(
scheme: "MyApp",
export_method: "app-store",
output_directory: "./build"
)
# Upload to TestFlight (skip waiting for processing to speed up CI)
upload_to_testflight(
skip_waiting_for_build_processing: true,
changelog: "Automated build: #{Time.now.strftime('%Y-%m-%d %H:%M')}"
)
end
endConfigure the App Store Connect API Key
You'll need an API key to authenticate uploads to TestFlight without interactive login.
- Go to App Store Connect → Users and Access → Keys → Generate a new key
- Download the
AuthKey_XXXXXXXXXX.p8file - Add the key path to your
Appfile:
# fastlane/Appfile
app_identifier("com.example.myapp")
apple_id("your@email.com")
# Path to your App Store Connect API key
api_key_path("./fastlane/AuthKey_XXXXXXXXXX.p8")Important: Add this .p8 file to your .gitignore immediately. Never commit API keys to version control. Store the file contents as a GitHub Secret instead.
Step 2: Set Up the GitHub Actions Workflow
Ask Antigravity to scaffold your CI workflow file:
"Create a .github/workflows/testflight.yml that automatically deploys
my iOS app to TestFlight. Trigger: pushes to release/* branches"
Here's an example of the generated workflow:
# .github/workflows/testflight.yml
name: TestFlight Deploy
on:
push:
branches:
- 'release/*'
jobs:
deploy:
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Restore App Store Connect API key
env:
ASC_API_KEY: ${{ secrets.ASC_API_KEY_CONTENT }}
run: |
mkdir -p fastlane
echo "$ASC_API_KEY" > fastlane/AuthKey.p8
- name: Run Fastlane beta lane
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: "120"
run: bundle exec fastlane betaYou'll need two GitHub Secrets configured in your repository settings. Antigravity can walk you through the setup:
ASC_API_KEY_CONTENT: The full contents of your.p8file (paste as-is)MATCH_PASSWORD: Your Fastlane Match encryption password
Step 3: Let Antigravity Handle Error Diagnosis
Build errors in CI environments can be tricky to debug. Paste any error log directly into Antigravity's chat and it will identify the root cause and suggest fixes.
Here's a real-world example of how Antigravity responds to a code signing error:
Build log excerpt:
error: No certificate found matching 'iPhone Distribution: Example Inc.'
Antigravity response:
"Code signing error detected.
Root cause: No Distribution certificate found in the local keychain.
Suggested fixes:
1. Run 'bundle exec fastlane match appstore' to sync certificates
2. Check Keychain access permissions on the CI runner
3. Verify that the Bundle ID matches what's registered in App Store Connect"
Antigravity helps you resolve these issues in minutes instead of hours. For more advanced CI/CD patterns with GitHub Actions, check out Building a Full iOS/Android CI/CD Pipeline with GitHub Actions and Antigravity.
Step 4: Automate Tester Management
Fastlane's pilot action makes it easy to automate tester onboarding and group management:
# Add to your fastlane/Fastfile
lane :add_testers do
add_new_testers(
testers_file_path: "./testers.csv",
groups: ["Internal QA", "Beta Users"]
)
endYou can export your tester list from a spreadsheet as a CSV and feed it directly into this lane. Ask Antigravity to write the CSV parsing logic for you — it's a one-line prompt that saves you a surprising amount of boilerplate.
Customizing the changelog parameter in upload_to_testflight also goes a long way: clear, actionable release notes encourage testers to actually try new features and submit feedback.
Common Errors and Fixes
Error 1: "No certificate found"
This typically happens when an old or conflicting certificate exists in the keychain.
# Remove stale certificates and regenerate
bundle exec fastlane match nuke distribution
bundle exec fastlane match appstoreError 2: "Build number already exists" on upload
TestFlight rejects duplicate build numbers. Make sure increment_build_number is always called in your Fastfile before the gym step.
Error 3: GitHub Actions macOS runner times out
Xcode can be slow to respond to build settings queries in CI. Set FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT to 120 seconds or higher to prevent premature timeouts.
Summary
In this guide, we walked through how to combine Antigravity, Fastlane, and GitHub Actions to fully automate TestFlight beta distribution.
Here's a quick recap of what makes this pipeline effective:
- Fastlane handles code signing, builds, and uploads in a single command
- GitHub Actions triggers the process automatically on every push to a release branch
- Antigravity acts as your AI copilot — generating configs, diagnosing errors, and keeping you unblocked
Eliminating manual release steps frees you to ship higher-quality beta builds more frequently, and gives your testers more to work with. Start with Fastlane setup, get one successful automated upload under your belt, and build from there.