Save it as:
~/.appstoreconnect/private_keys/AuthKey_YOUR_KEY_ID.p8
.testflight.env.example to .testflight.env and fill in the key ID
and issuer ID. .testflight.env and AuthKey_*.p8 are ignored by Git.From the Flutter project directory, run:
scripts/deploy_testflight.sh
The script increments the build number in pubspec.yaml, runs dependency
resolution, static analysis and tests, builds and validates the signed IPA, and
uploads it to App Store Connect. For a new app version:
scripts/deploy_testflight.sh --version 0.37.3
Use --dry-run to preview the version change or --skip-upload to build
without uploading. Run scripts/deploy_testflight.sh --help for all options.
The script ensures Flutter’s ephemeral Swift package exists, then pre-generates
and resolves its release configuration before archiving. It deliberately does
not delete ios/Flutter/ephemeral: Xcode needs the local package to exist when
configuration begins. If Xcode still encounters its transient Package.swift
was modified during the build race, the archive step regenerates the package
and retries once. Other build failures are not retried or hidden.
If a build, validation, or upload fails, the script restores the previous
pubspec.yaml version. This lets you rerun the deployment without accidentally
consuming another build number.
The upload makes the build available in App Store Connect after Apple’s processing finishes. Internal TestFlight groups can receive it automatically if automatic distribution is enabled. External testing still requires the build to be submitted for TestFlight Beta App Review in App Store Connect.