-
Notifications
You must be signed in to change notification settings - Fork 1
Firebase Project Setup
Sk Niyaj Ali edited this page Dec 25, 2024
·
2 revisions
- Creating a Firebase Project
- Registering an Android App
- Registering an iOS App
- GitHub Actions CI/CD Setup
- A Google account
- Access to the Firebase Console (https://console.firebase.google.com)
-
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
- Android Studio installed
- Your app's package name
- A development machine running Linux, macOS, or Windows
-
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
- Xcode installed
- Apple Developer account
- Your app's Bundle ID
- CocoaPods installed (if using)
-
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
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
- 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"
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