Making releases is a painful and time consuming task. While some of the tasks still need to be manual, some can be automated or reduce to a simple shell command.
At Tengio, we’ve been working on a few Flutter projects in the last few months and we’ve been following this procedure:
Create a build
Upload the build to Play Store internal track and TestFlight
Release to internal testers and developers for QA
Finally, promote release to a wider range of selected people
Using flutter and fastlane we have automated step 1 and 2. This is how we have done it.
Fastlane
“fastlane is the easiest way to automate beta deployments and releases for your iOS and Android apps.”
To install fastlane you use brew cask install fastlane
.
Add fastlane to your shell profile: export PATH=$HOME/.fastlane/bin:$PATH
.
Android releases with Play store
Google Play release management has now 4 types of releases: - Internal - Closed - Open - Production
In our setup we use fastlane to upload a new release to the internal track. Only when manual QA has been run on it, the release is promoted to internal and shared with a bigger audience of selected people.
Initialize Android fastlane
Ensure your flutter project runs properly :
flutter build apk
Init fastlane :
(cd android && fastlane init)
(use same package name as the one in the pubspec.yaml)From Google Play console you need to download the service account Json key. This is necessary to give fastlane permission to access Google Play console. Details of the steps for fastlane supply setup
Set the path to the json key file in the fastlane/Appfile
Run
(cd android && fastlane supply init)
to fetch all the Google Play store metadata.Create a lane for internal upload by editing the
fastlane/Fastfile
file
default_platform(:android)
platform :android do
desc "Submit a new build to Internal Track on Play"
lane :internal do
supply(track: "internal", apk:"../build/app/outputs/apk/release/app-release.apk", rollout: "1.0")
end
end
NOTE apk parameter is necessary for flutter builds.
Release on Android
Release is reduced to two simple commands:
flutter clean && flutter build apk
(cd android && fastlane android internal)
iOS releases with TestFlight
TestFlight uses two type of testers: Internal and External. - Internal, are connected users on iTunes - External, are users outside your team that wants to test your app.
TestFlight builds are immediately, after a quick processing phase, available to Internal users. Releases are, instead, accessible to External users only after review which can take up to a day.
Initialize ios fastlane
Ensure your flutter project runs properly :
flutter build ios --no-codesign
Init fastlane :
(cd ios && fastlane init)
. You need to select app_identifier, apple_id, itc_team_id and team_id.Run
(cd android && fastlane supply init)
.Create a lane for internal upload by editing the
fastlane/Fastfile
file with:
default_platform(:ios)
platform :ios do
desc "Push a new beta build to TestFlight"
lane :internal do
get_certificates
get_provisioning_profile
build_app(workspace: "Runner.xcworkspace", scheme: "Runner")
upload_to_testflight
end
end
NOTE: get_certificates, get_provisioning_profile are useful to ensure you have the correct xcode metadata for the build.
NOTE: You can additionally set a FASTLANE_PASSWORD in the shell.
Release on iOS
As for Android, the iOS release is now done with two simple commands:
flutter clean && flutter build ios
(cd ios && fastlane ios internal)
What’s next?
Continuous integration.