How to Auto Deploy APK to Firebase with One Click (EN)

Step-by-step guide to setting up auto deploy APK to Firebase using Bash, Zsh, and Fish Script.

Tags:
  • #Flutter
  • #Firebase
  • #Automation
  • #Bash Script
  • #Zsh Script
  • #Fish Script
Learning Path: Not Found | Category: DevOps

Table of Contents

  1. Introduction
  2. Requirements
  3. Setting up Firebase CLI
  4. Deploy Script: Bash, Zsh, and Fish
  5. Running the Function
  6. Adding Notifications After Deployment
  7. Conclusion

1. Introduction

Deploying APKs to Firebase manually can be time-consuming. To streamline this process, we can use automation scripts to deploy with a single command.

This guide will walk you through setting up Firebase CLI and creating a deployment function using Bash, Zsh, and Fish, along with adding notifications upon completion.


2. Requirements

Before starting, ensure you have:


3. Setting up Firebase CLI

  1. Log in to Firebase CLI:
    firebase login
  2. Get your Firebase project list:
    firebase projects:list
  3. Retrieve APP_ID from Firebase Console:
    • Open Firebase Console.
    • Select your project.
    • Go to Project settings.
    • In the General tab, find Your apps and copy the APP_ID for your Android app.

4. Deploy Script: Bash, Zsh, and Fish

Replace your-app-id with the APP_ID retrieved from Firebase Console.

function deployPPM() {
    APP_ID="your-app-id"
    flutter clean 
    flutter build apk --release &&     firebase appdistribution:distribute build/app/outputs/flutter-apk/app-release.apk     --app $APP_ID --release-notes "$1" --groups Tester1
}

For Fish Shell, use:

function deployPPM
    set APP_ID "your-app-id"
    flutter clean 
    flutter build apk --release &&     firebase appdistribution:distribute build/app/outputs/flutter-apk/app-release.apk     --app $APP_ID --release-notes $argv[1] --groups Tester1
end

5. Running the Function

To run the function, use:

deployPPM "Latest version release notes"

6. Adding Notifications After Deployment

For Xubuntu, add a notification:

function deployPPM() {
    APP_ID="your-app-id"
    flutter clean 
    flutter build apk --release &&     firebase appdistribution:distribute build/app/outputs/flutter-apk/app-release.apk     --app $APP_ID --release-notes "$1" --groups Tester1 &&     notify-send "Deployment Complete" "APK successfully uploaded to Firebase."
}

For macOS, replace notify-send with osascript:

osascript -e 'display notification "APK successfully uploaded to Firebase." with title "Deployment Complete"'

7. Conclusion

Using Bash, Zsh, or Fish functions, you can automate APK deployment to Firebase App Distribution with a single command. This saves time and reduces manual errors.

To deploy, simply run:

deployPPM "New feature updates and bug fixes."

You’ll receive a notification once the deployment is complete. 🚀

Logo Adib

© 2025 Adib

GitHub