Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time

Setting up the service account

This action requires a service account to authenticate with Firebase Hosting. The easiest way to set up the service account is to use the Firebase CLI with the firebase init hosting:github if that doesn't work for you, you can configure it manually.

Manually configure the service account

1. Create a service account that the action will use to deploy to Hosting

  1. Visit the GCP Service Accounts page and make sure the correct project (same name as your Firebase project) is selected in the top blue bar
  2. Click the "+ CREATE SERVICE ACCOUNT" button
  3. Give the service account a name, id, description. We recommend something like github-action-<my repository name>
  4. At the "Grant this service account access to project" step, choose the following roles that the service account will need to deploy on your behalf:
    • Firebase Authentication Admin (Required to add preview URLs to Auth authorized domains)
      • roles/firebaseauth.admin
    • Firebase Hosting Admin (Required to deploy preview channels)
      • roles/firebasehosting.admin
    • Cloud Run Viewer (Required for projects that use Hosting rewrites to Cloud Run or Cloud Functions)
      • roles/run.viewer
    • API Keys Viewer (Required for CLI deploys)
      • roles/serviceusage.apiKeysViewer
  5. Finish the service account creation flow

2. Get that service account's key and add it to your repository as a secret

  1. Create and download the new service account's JSON key
  2. Add that JSON key as a secret in your GitHub repository. We recommend a name like FIREBASE_SERVICE_ACCOUNT_<PROJECT_ID> (example: FIREBASE_SERVICE_ACCOUNT_MY_COOL_APP)

3. Add a workflow yaml file to your repository

  1. Add a yml file as described here. Be sure to reference your new secret for the firebaseServiceAccount option.