-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: flutter cd for staging and production environments (#207)
Co-authored-by: Matías Irland <[email protected]>
- Loading branch information
1 parent
9f83182
commit 733e23c
Showing
18 changed files
with
759 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
## flutter-ci.yml | ||
|
||
This YAML file contains the configuration for the continuous integration (CI) workflow for Flutter projects. It defines the steps and actions to be executed whenever changes are pushed to the repository. The CI workflow ensures that the code is built, tested, and validated before merging it into the main branch. | ||
|
||
## flutter-production-cd.yml | ||
|
||
This YAML file contains the configuration for the continuous deployment (CD) workflow for Flutter projects in a production environment. It defines the steps and actions to be executed when changes are merged into the main branch. The CD workflow automates the process of deploying the Flutter application to the production environment, ensuring a smooth and efficient release process. | ||
|
||
### Secrets required: | ||
|
||
GOOGLE_PLAY_SERVICE_ACCOUNT_CREDENTIALS_CONTENT | ||
FIREBASE_SERVICE_ACCOUNT_CREDENTIALS_BASE_64 | ||
IOS_DIST_CERTIFICATE_BASE_64 | ||
DIST_CERTIFICATE_PASSWORD | ||
APPSTORE_CONNECT_API_KEY_ID | ||
APPSTORE_CONNECT_API_KEY_ISSUER_ID | ||
APPSTORE_CONNECT_API_KEY_BASE_64 | ||
|
||
## flutter-staging-cd.yml | ||
|
||
This YAML file contains the configuration for the continuous deployment (CD) workflow for Flutter projects in a staging environment. It defines the steps and actions to be executed when changes are merged into the staging branch. The CD workflow automates the process of deploying the Flutter application to the staging environment, allowing for testing and validation before releasing to production. | ||
|
||
### Secrets required: | ||
|
||
GOOGLE_PLAY_SERVICE_ACCOUNT_CREDENTIALS_CONTENT | ||
FIREBASE_SERVICE_ACCOUNT_CREDENTIALS_BASE_64 | ||
IOS_DIST_CERTIFICATE_BASE_64_CONTENT | ||
FIREBASE_SERVICE_ACCOUNT_CREDENTIALS_BASE_64 | ||
APPSTORE_CONNECT_API_KEY_ID | ||
APPSTORE_CONNECT_API_KEY_ISSUER_ID | ||
APPSTORE_CONNECT_API_KEY_BASE_64_CONTENT | ||
IOS_DIST_CERTIFICATE_PASSWORD | ||
FIREBASE_SERVICE_ACCOUNT_CREDENTIALS_BASE_64 | ||
|
||
## pr-title-checker.yml | ||
|
||
This YAML file contains the configuration for a workflow that checks the title of pull requests (PRs) in a Flutter project. It defines the steps and actions to be executed whenever a new PR is created. The workflow ensures that the PR title follows a specific format or meets certain criteria, helping maintain consistency and clarity in the project's PRs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# IMPORTANT: ANDROID_KEYSTORE_NAME has to be set on github variables | ||
|
||
name: Release Android | ||
description: "Setup Android for release" | ||
inputs: | ||
key-properties-file: | ||
description: "Key properties file" | ||
required: true | ||
android-app-folder: | ||
description: "Android app folder" | ||
required: true | ||
|
||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 15 | ||
|
||
- name: Setup | ||
uses: ./.github/workflows/actions/flutter_setup | ||
with: | ||
setup-android: true | ||
|
||
- name: Download Android Keystore | ||
shell: bash | ||
env: | ||
KEYSTORE_BASE_64: ${{ secrets.ANDROID_KEYSTORE_BASE_64_CONTENT }} | ||
KEY_PROPERTIES_BASE_64: ${{ secrets.ANDROID_KEY_PROPERTIES_BASE_64 }} | ||
run: | | ||
echo -n $KEYSTORE_BASE_64 | base64 -d > ${{ vars.ANDROID_KEYSTORE_NAME }} | ||
echo -n $KEY_PROPERTIES_BASE_64 | base64 -d > ${{ inputs.key-properties-file }} | ||
working-directory: ${{ inputs.android-app-folder }} |
57 changes: 57 additions & 0 deletions
57
.github/workflows/actions/deploy-android-firebase/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Deploy Android Firebase | ||
description: "Deploy Android to Firebase" | ||
inputs: | ||
key-properties-file: | ||
description: "Key properties file" | ||
required: true | ||
firebase-base64-service-account-credentials: | ||
description: "Firebase service account credentials base64 encoded" | ||
required: true | ||
service-account: | ||
description: "Service account" | ||
required: true | ||
android-app-folder: | ||
description: "Android app folder" | ||
required: true | ||
app-env: | ||
description: "App environment" | ||
required: true | ||
build-number: | ||
description: "Build number" | ||
required: true | ||
firebase-app-id: | ||
description: "Firebase app ID" | ||
required: true | ||
firebase-tester-groups: | ||
description: "Firebase tester groups" | ||
required: true | ||
|
||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup android | ||
uses: ./.github/workflows/actions/setup-android | ||
with: | ||
"key-properties-file": ${{ inputs.key-properties-file }} | ||
"android-app-folder": ${{ inputs.android-app-folder }} | ||
|
||
- name: Download Firebase Service Account | ||
shell: bash | ||
env: | ||
SERVICE_ACCOUNT_CONTENT: ${{ inputs.firebase-base64-service-account-credentials }} | ||
run: | | ||
echo -n $SERVICE_ACCOUNT_CONTENT | base64 -d > ${{ inputs.service-account }} | ||
working-directory: ${{ inputs.android-app-folder }} | ||
|
||
- name: Deploy Android Staging to Firebase App Distribution | ||
env: | ||
APP_ENV: ${{ inputs.app-env }} | ||
BUILD_NUMBER: ${{ inputs.build-number }} | ||
FIREBASE_SERVICE_ACCOUNT_FILE: ${{ inputs.service-account }} | ||
FIREBASE_APP_ID: ${{ inputs.firebase-app-id }} | ||
FIREBASE_TESTER_GROUPS: ${{ inputs.firebase-tester-groups }} | ||
uses: maierj/[email protected] | ||
with: | ||
lane: "deploy_firebase_app_distribution" | ||
subdirectory: ${{ inputs.android-app-folder }} |
38 changes: 38 additions & 0 deletions
38
.github/workflows/actions/deploy-android-google-play/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Deploy Android Google Play | ||
description: "Deploy Android to Google Play" | ||
inputs: | ||
key-properties-file: | ||
description: "Key properties file" | ||
required: true | ||
android-app-folder: | ||
description: "Android app folder" | ||
required: true | ||
app-env: | ||
description: "App environment" | ||
required: true | ||
build-number: | ||
description: "Build number" | ||
required: true | ||
google-play-service-account-credentials-content: | ||
description: "Google Play service account credentials content" | ||
required: true | ||
|
||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup android | ||
uses: ./.github/workflows/actions/setup-android | ||
with: | ||
"key-properties-file": ${{ inputs.key-properties-file }} | ||
"android-app-folder": ${{ inputs.android-app-folder }} | ||
|
||
- name: Release to GooglePlay | ||
env: | ||
GOOGLE_PLAY_SERVICE_ACCOUNT_CREDENTIALS_CONTENT: ${{ inputs.google-play-service-account-credentials-content }} | ||
BUILD_NUMBER: ${{ inputs.build-number }} | ||
APP_ENV: ${{ inputs.app-env }} | ||
uses: maierj/[email protected] | ||
with: | ||
lane: "publish_prod_google_play" | ||
subdirectory: ${{ inputs.android-app-folder }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# IMPORTANT: IOS_CERTIFICATE_NAME has to be set on github variables | ||
|
||
name: Deploy iOS Firebase | ||
description: "Deploy iOS to Firebase" | ||
inputs: | ||
dist-certificate-base-64-content: | ||
description: "Distribution certificate base64 encoded" | ||
required: true | ||
ios-app-folder: | ||
description: "iOS app folder" | ||
required: true | ||
app-env: | ||
description: "App environment" | ||
required: true | ||
build-number: | ||
description: "Build number" | ||
required: true | ||
firebase-app-id: | ||
description: "Firebase app ID" | ||
required: true | ||
firebase-tester-groups: | ||
description: "Firebase tester groups" | ||
required: true | ||
service-account: | ||
description: "Service account" | ||
required: true | ||
firebase-service-account-base-64-content: | ||
description: "Firebase service account base64 encoded" | ||
required: true | ||
dist-cert-password: | ||
description: "Distribution certificate password" | ||
required: true | ||
appstore-connect-api-key-id: | ||
description: "Appstore connect API key ID" | ||
required: true | ||
appstore-connect-api-key-issuer-id: | ||
description: "Appstore connect API key issuer ID" | ||
required: true | ||
appstore-connect-api-key-base-64-content: | ||
description: "Appstore connect API key base64 encoded" | ||
required: true | ||
|
||
|
||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup iOS | ||
uses: ./.github/workflows/actions/setup-ios | ||
with: | ||
"dist-certificate-base-64-content": ${{ inputs.dist-certificate-base-64-content }} | ||
"ios-app-folder": ${{ inputs.ios-app-folder }} | ||
|
||
- name: Download Firebase Service Account | ||
shell: bash | ||
env: | ||
SERVICE_ACCOUNT_CONTENT: ${{ inputs.firebase-service-account-base-64-content }} | ||
run: | | ||
echo -n $SERVICE_ACCOUNT_CONTENT | base64 -d > ${{ inputs.service-account }} | ||
working-directory: ${{ inputs.ios-app-folder }} | ||
|
||
- name: Release to Firebase | ||
env: | ||
APP_ENV: ${{ inputs.app-env }} | ||
FIREBASE_SERVICE_ACCOUNT_FILE: ${{ inputs.service-account }} | ||
FIREBASE_APP_ID: ${{ inputs.firebase-app-id }} | ||
DIST_CERTIFICATE_PATH: ${{ github.workspace }}/ios/${{ vars.IOS_CERTIFICATE_NAME }} | ||
DIST_CERTIFICATE_PASSWORD: ${{ inputs.dist-cert-password }} | ||
APPSTORE_CONNECT_API_KEY_ID: ${{ inputs.appstore-connect-api-key-id }} | ||
APPSTORE_CONNECT_API_KEY_ISSUER_ID: ${{ inputs.appstore-connect-api-key-issuer-id }} | ||
APPSTORE_CONNECT_API_KEY_BASE_64_CONTENT: ${{ inputs.appstore-connect-api-key-base-64-content }} | ||
BUILD_NUMBER: ${{ inputs.build-number }} | ||
FIREBASE_TESTER_GROUPS: ${{ inputs.firebase-tester-groups }} | ||
|
||
uses: maierj/[email protected] | ||
with: | ||
lane: "deploy_firebase_app_distribution" | ||
subdirectory: ${{ inputs.ios-app-folder}} |
55 changes: 55 additions & 0 deletions
55
.github/workflows/actions/deploy-ios-testflight/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# IMPORTANT: IOS_CERTIFICATE_NAME has to be set on github variables | ||
|
||
name: Deploy iOS TestFlight | ||
description: "Deploy iOS to TestFlight" | ||
inputs: | ||
dist-certificate-base-64-content: | ||
description: "Distribution certificate base64 encoded" | ||
required: true | ||
ios-app-folder: | ||
description: "iOS app folder" | ||
required: true | ||
build-number: | ||
description: "Build number" | ||
required: true | ||
firebase-app-id: | ||
description: "Firebase app ID" | ||
required: true | ||
dist-cert-password: | ||
description: "Distribution certificate password" | ||
required: true | ||
appstore-connect-api-key-id: | ||
description: "Appstore connect API key ID" | ||
required: true | ||
appstore-connect-api-key-issuer-id: | ||
description: "Appstore connect API key issuer ID" | ||
required: true | ||
appstore-connect-api-key-base-64-content: | ||
description: "Appstore connect API key base64 encoded" | ||
required: true | ||
|
||
|
||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup iOS | ||
uses: ./.github/workflows/actions/setup-ios | ||
with: | ||
"dist-certificate-base-64-content": ${{ inputs.dist-certificate-base-64-content }} | ||
"ios-app-folder": ${{ inputs.ios-app-folder }} | ||
|
||
- name: Release to testflight | ||
env: | ||
APPSTORE_CONNECT_API_KEY_ID: ${{ inputs.appstore-connect-api-key-id }} | ||
APPSTORE_CONNECT_API_KEY_ISSUER_ID: ${{ inputs.appstore-connect-api-key-issuer-id }} | ||
APPSTORE_CONNECT_API_KEY_BASE_64_CONTENT: ${{ inputs.appstore-connect-api-key-base-64-content }} | ||
DIST_CERTIFICATE_PATH: ${{ github.workspace }}/ios/${{ vars.IOS_CERTIFICATE_NAME }} | ||
DIST_CERTIFICATE_PASSWORD: ${{ inputs.dist-cert-password }} | ||
FIREBASE_APP_ID: ${{ inputs.firebase-app-id }} | ||
BUILD_NUMBER: ${{ inputs.build-number }} | ||
|
||
uses: maierj/[email protected] | ||
with: | ||
lane: "publish_prod_testflight" | ||
subdirectory: ${{ inputs.ios-app-folder }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# IMPORTANT: FVM_VERSION, ANDROID_APP_FOLDER and IOS_APP_FOLDER have to be set on github variables | ||
|
||
name: Setup flutter | ||
description: "Setup infra" | ||
inputs: | ||
setup-android: | ||
description: "Setup Android" | ||
required: true | ||
setup-ios: | ||
description: "Setup iOS" | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: "zulu" | ||
java-version: "17" | ||
- uses: dart-lang/[email protected] | ||
- name: Cache FVM & Flutter | ||
uses: actions/cache@v3 | ||
with: | ||
path: /Users/runner/fvm/ | ||
key: ${{ runner.os }}-fvm-${{ hashFiles('**/fvm_config.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-fvm- | ||
- name: Cache pub cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: /Users/runner/.pub-cache/ | ||
key: ${{ runner.os }}-pub-cache | ||
- name: Install FVM && Flutter | ||
shell: bash | ||
run: dart pub global activate fvm ${{ vars.FVM_VERSION }} && fvm install --verbose && fvm use --force --verbose | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
bundler-cache: true | ||
- uses: ruby/setup-ruby@v1 | ||
if: ${{ inputs.setup-android }} | ||
with: | ||
bundler-cache: true | ||
working-directory: ${{ vars.ANDROID_APP_FOLDER }} | ||
- uses: ruby/setup-ruby@v1 | ||
if: ${{ inputs.setup-ios }} | ||
with: | ||
bundler-cache: true | ||
working-directory: ${{ vars.IOS_APP_FOLDER }} | ||
- name: Get dependencies | ||
uses: maierj/[email protected] | ||
with: | ||
lane: "fetch_dependencies" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# IMPORTANT: IOS_CERTIFICATE_NAME and XCODE_VERSION have to be set on github variables | ||
|
||
name: Release iOS | ||
description: "Setup iOS for release" | ||
inputs: | ||
dist-certificate-base-64-content: | ||
description: "Distribution certificate base64 encoded" | ||
required: true | ||
ios-app-folder: | ||
description: "iOS app folder" | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 15 | ||
|
||
- name: Select Xcode version | ||
run: sudo xcode-select -s /Applications/Xcode_${{ vars.XCODE_VERSION }}.app/Contents/Developer | ||
|
||
- name: Setup | ||
uses: ./.github/workflows/actions/flutter_setup | ||
with: | ||
setup-ios: true | ||
|
||
- name: Create distribution certificate | ||
shell: bash | ||
run: | | ||
echo -n ${{ inputs.dist-certificate-base-64-content }} | base64 --decode -o ${{ vars.IOS_CERTIFICATE_NAME }} | ||
working-directory: ${{ inputs.ios-app-folder}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,8 @@ jobs: | |
with: | ||
lane: 'tests' | ||
- name: 'Build android app' | ||
env: | ||
APP_ENV: 'dev' | ||
uses: maierj/[email protected] | ||
with: | ||
lane: 'android build_dev_debug_apk' | ||
|
Oops, something went wrong.