Deploying Flutter app to XCode Cloud
1 min read

Deploying Flutter app to XCode Cloud

Although the official documentation seems daunting initially, deploying and setting up CI/CD with Xcode Cloud is easy.

Click the Report Navigator icon in Xcode with your Runner.xcworkspace project open. Create a default workflow and delete Mac build action from it.

Create a post clone script at ios/ci_scripts/ location with the following content.


# The default execution directory of this script is the ci_scripts directory.
cd $CI_WORKSPACE # change working directory to the root of your cloned repo.

# Install Flutter using git.
git clone --depth 1 -b stable $HOME/flutter
export PATH="$PATH:$HOME/flutter/bin"

# Install Flutter artifacts for iOS (--ios), or macOS (--macos) platforms.
flutter precache --ios

# Install Flutter dependencies.
flutter pub get

# Install CocoaPods using Homebrew.
HOMEBREW_NO_AUTO_UPDATE=1 # disable homebrew's automatic updates.
brew install cocoapods

# Install CocoaPods dependencies.
cd ios && pod install # run `pod install` in the `ios` directory.

exit 0

Add the above file to Git and make it executable.

git add --chmod=+x ios/ci_scripts/

In the deployment preparation section of Archive - iOS select TestFlight if needed.

If you have manually deployed to TestFlight previously, give a higher build number to start within the settings section of Xcode Cloud on the app store connect website.

The build will now succeed.