Deploying Android Apps Using GitHub Actions

May 4 2023 · Kotlin 1.7.21, Android 13, Android Studio Electric Eel

Part 1: Automate Releases with GitHub Actions

07. Deploy to Firebase App Distribution

Episode complete

Play next episode

Next
About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 06. Authenticate Firebase Project Next episode: 08. Authenticate with Google Play Console

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Transcript: 07. Deploy to Firebase App Distribution

Now that you’ve set up Firebase and stored the secrets, you have to add the job to upload the app to Firebase App Distribution.

For this, you’ll use the wzieba/Firebase-Distribution-Github-Action action.

Upload Build to Firebase App Distribution

Add the following job to the workflow:

  deploy-firebase:
    needs: [ build ]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/download-artifact@v3
        with:
          name: release.apk
      - name: unzip downloaded APK
        run: unzip app-release-unsigned-signed.apk
      - name: upload artifact to Firebase App Distribution
        uses: wzieba/Firebase-Distribution-Github-Action@v1
        with:
          appId: ${{secrets.FIREBASE_APP_ID}}
          serviceCredentialsFileContent: ${{secrets.SERVICE_ACCOUNT}}
          groups: QA
          file: app-release-unsigned-signed.apk

This code uses:

  1. needs to specify that the job can only run if the build job has been completed successfully.
  2. The actions/download-artifact action to download the artifact of the release APK. It uploads the downloaded artifact to Firebase App Distribution and makes it available to the QA group you created earlier. It also uses the two secrets named FIREBASE_APP_ID and SERVICE_ACCOUNT, which you added in the previous section.

Commit and push the changes to GitHub.

git commit -m "Add Firebase deploy job"
git push origin master

Next, create a new tag and push it.

git tag v0.2 -a -m "Release v0.2"
git push origin master --follow-tags

Once you push the tag, visit the Actions tab in the repository.

You’ll see that the workflow is running.

Once the workflow has successfully finished running, verify that it uploaded the build by visiting the Releases tab on the App Distribution page on Firebase.

Congratulations, you’ve successfully set up a functional continuous delivery pipeline. You can also visualize the full workflow on GitHub.

Visualize The Workflow

On the Actions tab in the repository and click on the latest Test and deploy workflow execution.

Here, there are three boxes containing:

  1. unit_tests and android_tests
  2. The build job
  3. The deploy_firebase job

Horizontal lines connect the boxes. The box signifies that unit_tests and android_tests run in parallel. Only after both of them have been completed will the build job run. Similarly, the deploy_firebase job will run only after the build job completes.