created 2022/10/12
A sample code for distributing test ios app built with flutter via Firebase App Distribution with one tap of github actions. Sample is dedicated for circumstances using below.
flutter
fastlane
github actions
Firebase App Distribution
You can use the code by copy and paste, after preparing the prerequisites and environmental variables introduced below.
Whom using the sample is expected to have done below using the code
- manages flutter version with
fvm
- manages
flavors
for flutter project - manages iOS certificates and provisioning profiles with
fastlane match
- have activated firebase project and app distribution for the app
- MATCH_PASSWORD: passphrase you specified at first run of
fastlane match
reference - FIREBASE_TOKEN: token generated by
firebase login:ci
command reference - PERSONAL_TOKEN:
personal access token
of whom has access authorization to repository used by fastlane match reference
flutter has flutter build ios
and flutter build ipa
commands for building ios app. The difference is where build ios
builds app without archiving, build ipa
will build and archive in one go.
pros:
- can shorten execution time up to 40% compared to doing same execution with
flutter build ios
cons:
- certificates and provisioning files must be downloaded before execution which in this case, fastlane commands needs to be separated into two.
(executing
fastlane match
before build command and executingfastlane firebase_app_distribution
after the build.) - need to prepare
ExportOptions.plist
shortening execution time will save time and also money spent on github actions. If there are no obstacles, I would say go with flutter build ipa
command.
Example with flutter build ios
is also introduced below
https://gist.github.com/heyhey1028/fc8f999cc197373404ef0614d0063e25
- fvm: https://fvm.app/
- flutter flavors: https://docs.flutter.dev/deployment/flavors
- about
flutter build ipa
: https://docs.flutter.dev/deployment/ios#create-a-build-archive-and-upload-to-app-store-connect - fastlane: https://fastlane.tools/
- fastlane match: https://docs.fastlane.tools/actions/match/
- firebase_app_distribution: https://firebase.google.com/docs/app-distribution/ios/distribute-fastlan
Please leave a comment if you have any trouble trying to reference the code. Also pressing a star would help me motivated in creating sample codes. Thanks!!