This GitHub Action uploads an artifact to Firebase App Distribution and optionally distributes it to specified groups.
serviceCredentialsFileContent
: Required. The JSON content of the Firebase service account key used for authentication.appId
: Required. The Firebase App ID to which the artifact will be uploaded.file
: Required. The path to the artifact file (e.g., APK or IPA) you want to upload.groups
: Optional. A comma-separated list of distribution group aliases to which the artifact will be distributed.
releaseName
: The name of the release created in Firebase App Distribution.
To use this action in your workflow, follow these steps:
-
Prepare your Firebase Service Account Key:
- Go to the Firebase Console.
- Select your project and go to Project settings > Service accounts.
- Generate a new private key and save the JSON file.
-
Add your Service Account Key to GitHub Secrets:
- Go to your GitHub repository's Settings > Secrets.
- Add a new secret containing the entire JSON content of the Firebase service account key file. Name it something like
FIREBASE_SERVICE_ACCOUNT_KEY
.
-
Configure the Workflow:
- In your repository, create a
.github/workflows
directory if it doesn't exist. - Create a new YAML file for your workflow (e.g.,
.github/workflows/firebase-distribution.yml
).
- In your repository, create a
-
Add the Workflow Configuration:
name: Distribute App via Firebase
on:
push:
branches:
- main # Or any other branch from which you want to distribute builds
jobs:
firebase_distribution:
runs-on: ubuntu-latest # Can be any supported runner
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Upload and Distribute App
uses: mastersam07/firebase-app-distribution-action@v0.1
with:
serviceCredentialsFileContent: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_KEY }}
appId: ${{ secrets.FIREBASE_APP_ID }}
file: '<path-to-your-artifact>' # e.g., './build/app/outputs/flutter-apk/app-release.apk'
groups: 'testers,qa' # Optional: distribution groups
After you've cloned the repository to your local machine or codespace, you'll need to perform some initial setup steps before you can develop your action.
Note
You'll need to have a reasonably modern version of
Node.js handy. If you are using a version manager like
nodenv
or
nvm
, you can run nodenv install
in the
root of your repository to install the version specified in
package.json
. Otherwise, 20.x or later should work!
-
🛠️ Install the dependencies
npm install
-
🏗️ Package the JavaScript for distribution
npm run bundle
-
✅ Run the tests
$ npm test PASS __tests__/index.test.js Firebase App Distribution Action ✓ uploads a file successfully (2 ms) ✓ handles upload failure ...