Skip to content

Tutorial use Fastlane

Hiếu edited this page Jan 5, 2021 · 3 revisions

1. Upload build to Firebase

Step 1: update Fastfile

  • Open file Fastfile (android/fastlane/Fastfile)

platform :android do
  desc "Deploy with Fastlane"
  gradle(
      task: 'assemble',
      build_type: 'Release'
  )
  lane :<name_your_lane> do
      firebase_app_distribution(
          app: "<FirebaseAppID>",
          testers: "[email protected], [email protected]",
          release_notes: "<Release note>",
          firebase_cli_path: "<path-firebase-cli>",
          firebase_cli_token: "<firebase-cli-token>",
          apk_path: "path-file-apk-release"
      )
  end
end
  • update FirebaseAppID (https://console.firebase.google.com/)

  • name_your_lane is name of lane

  • [email protected], [email protected] : Add your email and email test team to test the app out when the firebase upload is successful

  • Release note : release note of build version

  • path-firebase-cli : you can find it by typing the command : which firebase

  • path-file-apk-release : is path save apk release (Ex: ../build/app/outputs/flutter-apk/app-release.apk)

Step 2: Run fastlane

  • Run fastlane

    fastlane android <name_your_lane>

  • Done

  • Check firebase console

2. Upload build to Play Store

Step 1:

Step 2:

  • Open file FastFile and add new lane

    lane :name_of_lane_upload_store do
        upload_to_play_store(
          track: 'alpha',
          apk:'../build/app/outputs/flutter-apk/app-release.apk'
        )
    end
    
  • track : The track of the application to use. The default available tracks are: production, beta, alpha, internal

  • apk : is path file apk release

  • You can refer to it when type the command: fastlane action upload_to_play_store

Step 3:

  • Run command

    fastlane android <name_of_lane_upload_store>

**** NOTE: if you run fastlane android <lane_name> is error, plesase command:**

bundle exec fastlane android <name_of_lane_upload_store>
  • After completing the above setup steps, you can also use fastlane quickly using the script available in the FluxStore (provided you do not change the lane name in Fastfile but only update your application information. )

bash fastlane.sh --android

## Use script fastlane
Usage: bash fastlane.sh <option>

Script build and upload to Firebase or Store with Fastlane.
Options: 

-h,--help       display this usage message and exit
--android       Only build Android, then upload them to Firebase and Play Store (alpha test)
--android-dev   Only build Android, then upload them to Firebase  
--android-prod  Only build Android, then upload them to Play Store (alpha test)