Firebase Project Setup - openMF/mifos-x-actionhub GitHub Wiki
Table of Contents
- Creating a Firebase Project
- Registering an Android App
- Registering an iOS App
- GitHub Actions CI/CD Setup
Creating a Firebase Project
Prerequisites
- A Google account
- Access to the Firebase Console (https://console.firebase.google.com)
Steps to Create a Project
-
Access Firebase Console
- Go to https://console.firebase.google.com
- Sign in with your Google account
-
Create New Project
- Click "Create Project" or "Add Project"
- Enter a project name (this will be visible to your team)
- Choose whether to enable Google Analytics (recommended)
- Accept the Firebase terms of service
- Click "Create Project"
-
Configure Project Settings
- Once created, you'll be taken to the project dashboard
- Click the gear icon next to "Project Overview" to access project settings
- Note your Project ID as you'll need it later
Registering an Android App
Prerequisites
- Android Studio installed
- Your app's package name
- A development machine running Linux, macOS, or Windows
Steps to Register Android App
-
Add Android App to Firebase
- In Firebase Console, click the Android icon (</>) on the project overview page
- Enter your Android app's package name (e.g., com.company.appname)
- Enter app nickname (optional)
- Enter SHA-1 signing certificate (optional, but recommended for features like Google Sign-In)
- Click "Register App"
-
Download Configuration File
- Download the
google-services.json
file - Move the file into your Android app module's root directory
- Usually located at
/app/google-services.json
- Download the
Registering an iOS App
Prerequisites
- Xcode installed
- Apple Developer account
- Your app's Bundle ID
- CocoaPods installed (if using)
Steps to Register iOS App
-
Add iOS App to Firebase
- In Firebase Console, click the iOS icon (</>) on the project overview page
- Enter your iOS bundle ID (e.g., com.company.appname)
- Enter app nickname (optional)
- Enter App Store ID (optional)
- Click "Register App"
-
Download Configuration File
- Download the
GoogleService-Info.plist
file - Add the file to your Xcode project
- Make sure to add it to all appropriate targets
- Select "Copy items if needed" when adding
- Download the
GitHub Actions CI/CD Setup
google-services.json
for GitHub Secrets
Encoding 1. Convert google-services.json to Base64
On macOS/Linux:
base64 -i app/google-services.json
On Windows (PowerShell):
[Convert]::ToBase64String([System.IO.File]::ReadAllBytes("app/google-services.json"))
Or Use Web to encode or decode files here
2. Store in GitHub Secrets
- Go to your GitHub repository
- Navigate to
Settings > Secrets and variables > Actions
- Click
"New repository secret"
- Name:
GOOGLE_SERVICES_JSON
- Value:
Paste the entire Base64 encoded string
- Click
"Add secret"
3. Use in GitHub Actions Workflow
Create or modify your workflow file (e.g., .github/workflows/android-build.yml
):
name: Android CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Decode google-services.json
env:
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: |
echo $GOOGLE_SERVICES_JSON | base64 -d > app/google-services.json
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build