Skip to content

Latest commit

History

57 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

ZWEIDENKER Flutter Workflows

Workflows used at ZWEIDENKER to build and deploy Flutter Apps.

Melos Quality Checks

quality:
uses: zweidenker/flutter_workflows/.github/workflows/melos_quality_checks.yaml@v2with:
setup: truelint: falsetest: true

Performs quality checks for repositories using melos

Inputs

NameTypeDescriptionDefaultrequired
setupbooleanShould run melos run setuptrue
lintbooleanShould run melos run lint:alltrue
testbooleanShould run melos run test:coverage:alltrue
runnerstringGithub actions runnerubuntu-latest
lfsbooleanEnable git lfsfalse

Build Android

build_android:
needs: qualityuses: zweidenker/flutter_workflows/.github/workflows/build_android.yaml@v2with:
appDirectory: packages/appbuildApk: falsebuildBundle: trueupload: ${{ github.ref_name == 'main' }}secrets:
additionalBuildArguments: --dart-define=API_KEY=${{ secrets.API_KEY }}keyStore: ${{ secrets.ANDROID_KEYSTORE }}keyStorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}keyAlias: ${{ secrets.ANDROID_KEY_ALIAS }}googleApiKey: ${{ secrets.GOOGLE_API_KEY }}

Setup

In order to setup signing the app's build.gradle needs to contain the following blocks.

...
def keystoreProperties =newProperties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(newFileInputStream(keystorePropertiesFile))
}
android {
...
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
...
}

Also in /path/to/app/android/fastlane/Fastfile there should be the following lane

desc"Deploy App to Internal Google Play Track"lane:uploadAppdo |options|
supply(aab: "../build/app/outputs/bundle/release/app-release.aab",json_key_data: ENV['GOOGLE_UPLOAD_KEY'],track: "internal")end

⚠️ Note that GOOGLE_UPLOAD_KEY is accessed using ENV and not through options

Inputs

NameTypeDescriptionDefaultrequired
appDirectorystringDirectory where the app is based on the repository root. eg packages/app*
buildApkbooleanShould build an Apktrue
buildBundlebooleanShould build an App Bundletrue
uploadbooleanShould upload the App to Google Play. Note this will also check if the current workflow does not run on a pull_request eventfalse
archiveArtifactsbooleanIf the workflow should archive apks and aabs. This normally should only be needed for a first release build to upload manually to Google Play or for certain PRsfalse
runnerstringGithub actions runnerubuntu-latest
lfsbooleanEnable git lfsfalse
buildNumberOffsetnumberAn Offset used to generate the BuildNumber. This will result in the build number being the offset + the Run Number of Github. This is only required if there are already builds on the Play Store in order to have an increasing Build Number.0

Secrets

NameDescriptionrequired
additionalBuildArgumentsArguments that will be appended to the flutter build command. e.g --dart-define
keyStoreAndroid Signing Key. Encoded as a base64 String*
keyStorePasswordKeystore Password*
keyPasswordKey Password*
keyAliasKey Alias*
googleApiKeyGoogle Play Service Account json key used to upload. Information on how to optain this can be found here

Build iOS

build_ios:
uses: zweidenker/flutter_workflows/.github/workflows/build_ios.yaml@v2with:
appDirectory: packages/appfastlaneEnv: appupload: ${{ github.ref_name == 'main' }}secrets:
additionalBuildArguments: --dart-define=API_KEY=${{ secrets.API_KEY }}matchPassword: ${{ secrets.MATCH_PASSWORD }}apiKey: ${{ secrets.IOS_API_KEY }}matchSSHKey: ${{ secrets.MATCH_GIT_PRIVATE_KEY }}

Setup

For the pipeline to work the following fastlane configurations must be met

There is a valid Matchfile under path/to/app/ios/fastlane/Matchfile

The following lanes are defined in path/to/app/ios/fastlane/Fastfile

lane:certificatesdo |options|
setup_ci()api_key_path=ENV['IOS_API_KEY']match(type: "appstore",readonly: true)enddesc"build app"lane:buildAppdo |options|
setup_ci()gym(export_options: "fastlane/export_options/app-store.plist",output_directory: 'build',)enddesc"upload to testflight"lane:uploadAppdo |options|
upload_to_testflight(ipa: "build/Runner.ipa",api_key_path: ENV['IOS_API_KEY'],app_identifier: ENV['APP_IDENTIFIER'],skip_waiting_for_build_processing: true)end

⚠️ Note that IOS_API_KEY is accessed using ENV and not through options

⚠️ Note that the certificates and buildApp lane contain calls to setup_ci() to ensure proper keychain management

Inputs

NameTypeDescriptionDefaultrequired
appDirectorystringDirectory where the app is based on the repository root. eg packages/app*
matchHoststringHost that is used for fastlane match repository. This is needed, as ZWEIDENKER currently host our match repository on bitbucketbitbucket.org
fastlaneEnvstringFastlane Environment*
uploadbooleanShould upload the App to Testflight. Note this will also check if the current workflow does not run on a pull_request eventfalse
runnerstringGithub actions runnermacos-latest
lfsbooleanEnable git lfsfalse
buildNumberOffsetnumberAn Offset used to generate the BuildNumber. This will result in the build number being the offset + the Run Number of Github. This is only required if there are already builds on the App Store in order to have an increasing Build Number.0
NameDescriptionrequired
additionalBuildArgumentsArguments that will be appended to the flutter build command. e.g --dart-define
matchPasswordFastlane Match Password*
apiKeyApple Api Key as a unencoded json. The format can be found here*
matchSSHKeyPrivate SSH Key to access the match repository*

About

Workflows for Flutter Apps

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors