Skip to content
Snippets Groups Projects
Select Git revision
  • 1176ca45eb82142c3c44ca328bad0de83f066899
  • master default protected
  • development
3 results

apkforfastlane

  • Clone with SSH
  • Clone with
  • user avatar
    Krishna Prasad N authored
    1176ca45
    History

    Fastlane

    Fastlane is a popular open-source toolset designed to automate the process of building, testing, and releasing mobile apps for iOS and Android platforms. It helps streamline various tasks such as building, code signing, testing, deploying, and releasing apps, reducing the manual effort required for these tasks and improving the overall development workflow.

    Fastlane provides a collection of tools and actions that can be configured and combined to create custom workflows tailored to specific project requirements. Some of the key features and capabilities of Fastlane include:

    What is this repo

    This repo is a reference repo for native Android project with fastlane integration. This repo has the required fastlane setup and the

    Fastlane setup in the project

    Fastlane needs Ruby in the system, below command can be used to install Ruby in the Linux system

    sudo apt-get install -y ruby-full

    Install Bundler using RubyGems

    sudo gem install bundler

    Create ./Gemfile in the project root directory with below content source "https://rubygems.org" gem "fastlane

    Then Run

    bundle update

    Install Fastlane

    sudo gem install fastlane

    Set up the Fastlane

    fastlane init

    You'll be asked to confirm that you're ready to begin, and then for a few pieces of information. To get started quickly:

    Provide the package name for your application when asked (e.g. io.fabric.yourapp) Press enter when asked for the path to your json secret file Answer 'n' when asked if you plan on uploading info to Google Play via fastlane (we can set this up later)

    That's it! fastlane will automatically generate a configuration for you based on the information provided.

    You can see the newly created ./fastlane directory, with the following files:

    Appfile which defines configuration information that is global to your app Fastfile which defines the "lanes" that drive the behavior of fastlane

    Appfile: This include any credentials details or the keystore details

    Fastfile: This is the actual file which includes the lane. Refer the fastfile from this repo which includes the lanes for build, firebase app distribution and Google play upload.

    For more details refer: https://docs.fastlane.tools/getting-started/android/setup/

    Jenkins VM Setup

    Setup a Jenkins VM and install the below software.

    Install Java Follow the instructions in the guide https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-on-ubuntu-22-04

    Install Android SDK Refer to the steps provided https://linuxopsys.com/topics/install-android-sdk-without-android-studio-on-ubuntu

    Install Fastlane Follow the steps outlined in https://linuxopsys.com/topics/install-android-sdk-without-android-studio-on-ubuntu

    Ref: https://docs.fastlane.tools/best-practices/continuous-integration/jenkins/

    Jenkins Configuration

    Setup the Webhook in the Project Repo so that when the development team pushes the changes to the repo, it will trigger the pipeline.

    Set Android SDK Root in Jenkins:

    Go to Manage Jenkins -> System -> Android SDK. Add the path of the Android SDK in your Jenkins VM.

    Create Jenkins Job:

    Create a new Jenkins job with pipeline configuration settings. Enable "Build when a change is pushed to GitLab" in Build Triggers. Choose "Pipeline script from SCM" in Pipeline definition. Set SCM to Git. Enter the repository URL of your GitLab repo. Choose the appropriate credentials. Specify the branch name. Set the repository browser to Auto. Set the script path to Jenkinsfile. Click on Save button

    Refer the 'Jenkinsfile' in the repo for the pipeline stages which creates the Android build and pushes it to Firebase App Distribution and Google Play Store

    Dependencies:

    1. Jenkins VM setup with required software installation as mention above
    2. Firebase setup to get the service account and store it in the Jenkins VM - https://firebase.google.com/docs/app-distribution/android/distribute-fastlane
    3. Google play store setup - create a service account and provide the required permission to the SA in the Google Playstore console. - https://devjorgecastro.medium.com/how-to-deploy-your-android-app-to-the-internal-track-in-the-play-store-console-using-fastlane-4f66efdabc12
    4. For the first time, we need to manually upload the Android app to the Google Playstore atleast once.