Skip to content

Latest commit

 

History

History
205 lines (139 loc) · 4.15 KB

File metadata and controls

205 lines (139 loc) · 4.15 KB

Firebase

Fastlane App Distribution to Firebase

See Fastlane doc and this doc:

https://firebase.google.com/docs/app-distribution/ios/distribute-fastlane

Firebase CLI

https://firebase.google.com/docs/cli

On Mac:

brew install firebase-cli

Or using npm:

npm install -g firebase-tools

Or using autoinstall script:

curl -sL https://firebase.tools | bash

Or from DevOps-Bash-tools:

install_firebase_cli.sh

Or download and chmod +x it manually from:

https://firebase.tools/bin/macos/latest

https://firebase.tools/bin/linux/latest

(these redirect to the latest release from https://github.com/firebase/firebase-tools/releases/)

Firebase Login

Interactive web browser redirect to log in as your user.

firebase login
firebase login:list
Logged in as hari@domain.com

Firebase Google Application Credentials

AdminSDK

You can generate this at the top left Project Settings -> Service Accounts -> Generate new private key for the firebase-adminsdk-xxxxx@$PROJECT_ID.iam.gserviceaccount.com.

Dedicated Role with Restricted Permissions

If you don't want to use the default adminsdk key, create a new service account by clicking Manage service account permissions at the top right of the above Service Accounts page, then create a new service account and grant it only Firebase App Distribution Admin. Then on the service account page -> Keys -> Add key and download it.

Configure and test Google Application Credentials

export GOOGLE_APPLICATION_CREDENTIALS="path/to/your-file.json"

firebase login:list will still show:

 ⚠  No authorized accounts, run "firebase login"

but commands will work. List projects to prove it.

List Projects

firebase projects:list
firebase projects:list --json

Unfortunately projects:list returns zero even when outputting No projects found. imply the credential is invalid or doesn't have the right permissions.

To test this properly in scripts or CI/CD:

num_projects="$(firebase projects:list --json | jq '.result | length')"
if [ "$num_projects" -eq 0 ]; then
    exit 1
fi

See also from DevOps-Bash-tools:

firebase_foreach_project.sh

Configure Default Project

Specifying --project for every firebase command is tedious.

--project "<project_id>"

See the Project ID column from firebase projects:list.

Instead, create .firebaserc:

{
  "projects": {
    "default": "myproject-dev-id",
    "dev": "myproject-dev-id",
    "staging": "myproject-staging-id",
    "prod": "myproject-production-id",
  }
}

You can also use these shorter names:

--project "dev"

instead of

--project "myprofile-dev-id"

List Apps

To get the Firebase App ID that you need to push artifact releases to:

firebase apps:list --project "myproject"

or if you've set up the project config defaults above:

firebase apps:list
firebase apps:list --json

Firebase App Distribution Upload

Tester emails are comma separated.

firebase appdistribution:distribute \
        --testers "$TESTER_EMAILS" \
        --app "$FIREBASE_APP_ID" \
        build/"$APP-$ENV".ipa