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.
- 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
- Click the "+ CREATE SERVICE ACCOUNT" button
- Give the service account a name, id, description. We recommend something like
github-action-<my repository name>
- 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
- Firebase Authentication Admin (Required to add preview URLs to Auth authorized domains)
- Finish the service account creation flow
- Create and download the new service account's JSON key
- 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
)
- Add a yml file as described here. Be sure to reference your new secret for the
firebaseServiceAccount
option.