Open In App
Related Articles

How to Upload Android APK to Testers Group in Firebase Using GitHub Actions?

Like Article
Save Article
Report issue

Testing is always required whenever we build an app to ensure it functions properly in production. It might be time-consuming and inconvenient to send the application to the testers every time new code is merged into the codebase. So to solve this problem, CD pipelines can be used to deliver the software to the testers. In this article, we’ll be learning to build a CD pipeline for Android and send the APK to the testers group in Firebase.

Pre-requisites: Git, Github, Basic understanding of building CI/CD pipelines and GitHub Actions, Setup of Firebase.

Now as we know how to set up Firebase and have generated the TokenID, keep it safe as we’ll need the same TokenID while we’ll code our CD pipeline. So first of all go to Firebase and create a new project. Write the name of the project as you wish. Now follow the guidelines of setting up firebase in your android project. After you have added Firebase to your Android project, go to the Firebase Console, select your project, and scroll to the bottom of the console. Now click on See all Extension features. In Release and Monitor section, click on App Distribution -> Testers & Groups -> Add group. Name the group as “project-testers” and add your email id to it. 

After that go back to the settings of your project and copy the AppID. Keep it safe, we will be using that too in our code. 

Now, we can create our CD pipeline using GitHub actions and upload our APK to the testers group that we created in Firebase. Create a .yml file named releases.yml in .github/workflows directory under the project’s root directory. Start writing the below code in that file.

name: Build and Release
     - master
     - v*
   name: Upload APK to App Tester
   runs-on: ubuntu-latest
     - uses: actions/checkout@v2.4.0
     - name: Setup JDK
       uses: actions/setup-java@v2.5.0
         distribution: temurin
         java-version: '11'
     - name: build release
       run: bash ./gradlew assembleDebug
     - name: upload artifact to Firebase App Distribution
       uses: wzieba/Firebase-Distribution-Github-Action@v1.2.2
         appId: 'Enter you AppID here'
         token:  'Enteer your TokenID here'
         groups: project-testers
         file: app/build/outputs/apk/debug/app-debug.apk

Whenever there will be a push of code in the master branch, this workflow will be triggered. It will then set up JDK and build that APK for release. After this is done, it will upload the file app/build/outputs/apk/debug/app-debug.apk to the project-testers group that we created in Firebase. Now commit this code, and you will see the workflow running in the Actions tab of your project on GitHub. 

After the workflow run is finished, go to the releases tab of your project in firebase and you’ll see a release published over there.

In this way, the testers can download the app from there and can test it. Each time new code is pushed into the master branch, this workflow will trigger, and upload the APK for testing.

Last Updated : 14 Feb, 2022
Like Article
Save Article
Share your thoughts in the comments
Similar Reads