Bitrise- Flavor Wise Workflow for Flutter Integration Part-2
We hope you have set up your project & workflow into the Bitrise by following the instructions from “Part-1” of this series. In this tutorial, we’ll focus on different flavor-wise workflow configurations.
Prerequisites:
- We assume you have integrated Bitrise basic flow setup as per Part-1
- Proceeding further, We will take the reference/clone workflow of part-1 & will update accordingly to make multiple flavor-wise builds & release it to AppCenter & App Store.
Let’s get started with Bitrise Integration Part-2 to set up different flavor-wise workflows & release builds accordingly:
- We will explain two methods to achieve the flavor-wise builds
- There will be examples of 2 different flavors of a single project
- Case 1: Development [dev]
- Case 2: Production [prod]
Case1:Build multiple applications with a single workflow
- First, prepare a 100 % clone copy of the existing workflow.
- We have the last six steps related to preparing build & publish app over AppCenter & App Store in the existing workflow.
- Those last six steps will put it one after another for N number of flavors we want to keep.
- You have to change only in flutter_bid command -> Just Change command of the main file according to flavor e.g [lib/main.dart, lib/main_dev.dart, lib/main_prod.dart]
- The rest of the steps will remain the same.
- To make it look reasonable & systematic, we can release flavor-wise applications in different groups.
- Here are the Workflow Steps:
- Development: [ Set Xcode Project Build Number, Flutter Build, Xcode Archive & Export to iOS, Deploy to iTunes, Deploy AppCenter, deploy to Bitrise ]
- Production: [ Set Xcode Project Build Number, Flutter Build, Xcode Archive & Export to iOS, Deploy to iTunes, Deploy AppCenter, deploy to Bitrise]
Pros of Case1:
- You can prepare multiple builds for every flavor, even while running a workflow in a single time only.
- And because of this very reason, it takes less time to prepare builds & complete a workflow as compared to running a single flavor workflow for each different flavor. As Case2 will run the whole workflow from start to end, it will take 2X of time, wherein in case 1, only specific steps will run concurrently.
Cons of Case1:
- It takes longer than usual as it builds & Releases each flavor-wise build every time.
- Even if you want to build for a single flavor, you have to wait for the release of both builds, then only you will receive build pass status.
Case2: Prepare each flavor-wise different workflow
- For this case, we will create two separate workflows for each flavor [Development, Production]
- As we know, we can run a single workflow at a time. So, here are some triggers for each flavor-wise workflow.
1. Development workflow Trigger When -> Any Feature Branch To Develop branch
2. Production workflow trigger When -> Develop Branch To Main/Master Branch
- We have a flutter build command of the main production file for Production workflow.
- Similarly, we have to keep the flutter build command for the Development mail file in the Development workflow.
Pros of Case2:
- We can prepare a build for specifically required flavor while running a workflow. It naturally takes less time to prepare & complete a workflow.
Cons of Case2:
- We can prepare a build of only the selected flavor. So, if we want to run another flavor for a specific build while running a workflow, then we have to build it manually.
- Also, as we have to generate another flavor manually for specific scenarios, it will run the whole workflow from start to end and take 2X of time. Wherein case 1, only some specific steps will run concurrently. The rest of the steps will run only once.
Bitrise Yml File of Case1:Build multiple applications with a single workflow
Bitrise Yml File of Case2:Prepare each flavor-wise different workflow
I hope you have enjoyed reading this as much as I’ve enjoyed writing it. If you believe this tutorial will help someone, do not hesitate to share! Smash the clap below, and let other people know how to achieve flavor-wise workflow configuration for Flutter integration.