Leave a rating/review
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:
- needs to specify that the job can only run if the build job has been completed successfully.
- 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:
- unit_tests and android_tests
- The build job
- 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.