DEV Community

CodeTrade India Pvt. Ltd.
CodeTrade India Pvt. Ltd.

Posted on

Steps to Add and Upload testflight Using Fastlane

Let’s deep dive into the CI/CD Pipeline for iOS with flavour using Fastlane. With the example of the CI/CD pipeline for iOS, you can better understand the flavour using Fastlane.

Build CI/CD Pipeline for iOS with Flavour using Fastlane

We use the ‘’ package name (bundle identifier), in this package name we have three flavours.

  1. dev
  2. prod
  3. stage

Before you proceed with the CI/CD pipeline integration with Fastlane, it is essential to have -

Initial setup for Fastlane using the Fastlane Flutter Complete Guide

  • An Active AppStore Developer Account with a subscription
  • App-specific password from Apple developer console
  • Apps should be created on Apple Console with the above flavors
  1. for Dev flavour
  2. for Production flavour
  3. for Stage/Testing flavour
  • Text Editor(we’ll use VS Code for this example).

Steps to Add Upload testflight Using Fastlane

To add upload TestFlight using Fastlane, you will need to follow the given process:

1. Change Fastlane AppFile

Make changes in Fastlane AppFile according to your requirements. In our example, we make changes in the Fastlane Appfile as shown below code,

# The bundle identifier of your app

# Your Apple Developer Portal username

# App Store Connect Team ID

# Developer Portal Team ID
Enter fullscreen mode Exit fullscreen mode

Change Fastlane AppFile

2. Use Environment Variable

In our case, we use the following environment variables you can use the same if you want.

  • FASTLANE_USER: Your developer user account
  • WORKSPACE: The path to your workspace file
  • EXPORT_METHOD: The export method to use when creating the IPA file
  • ARCHIVE_PATH: The path to the archive file generated by Fastlane
  • OUTPUT_DIRECTORY: The path to the directory where the IPA file will be saved
  • DEV_APP_ID: The app identifier for the development flavor of your app
  • STAGE_APP_ID: The app identifier for the staging flavor of your app
  • IPA_PATH: The path to the IPA file generated by Fastlane

You can use these same environment variables in your own Fastlane Fastfile. To do this, simply add them to the ENV dictionary in your Fastfile. For example: 
WORKSPACE=Runner. xcworkspace 
STAGE_APP_ID="com. example." 
IPA_PATH=". /Runner. ipa" 
Enter fullscreen mode Exit fullscreen mode

Use Environment Variable

3. Create Lane

Once you have added the environment variables to your Fastfile, you can use them in your lanes. Here, we will create only one public lane and the other will be private. you can make all three public if you want.

  • flutter_app -> public lane
  • flutter_app_dev -> private lane for dev flavour
  • flutter_app_prod -> private lane for prod flavour
  • flutter_app_stage -> private lane for stage flavour

For example,

platform :ios do
    desc "Flutter App"

    lane :flutter_app do
        flavor = UI. input ("Which Flavor do you want to upload? ")
        puts ("Generating '#{flavor}' Build...")
            case flavor 
                when "dev"
                when "stage"
                when "prod"
                    UI. user _error! "Please choose the proper option: #{flavor. inspect]"
Enter fullscreen mode Exit fullscreen mode

4. Provide Definitions for Lanes

Here we’re providing definitions for the above lanes, for prod and stage lanes you can simply replicate this step by changing the app identifier. In our case, we provide definitions for the above lanes, for prod and stage lanes you can simply replicate this step by changing the app identifier.

Click the given link to view the complete steps to Add and upload testflight Using Fastlane in Flutter.

Keep Learning....!

Top comments (0)