angularfire icon indicating copy to clipboard operation
angularfire copied to clipboard

Deploy not working with service account in github actions

Open zal1000 opened this issue 2 years ago • 1 comments

Version info

Angular: 14.1.0

AngularFire: 7.4.1

Firebase CLI: Latest being downloaded every time by the actions runner

How to reproduce these conditions

Steps to set up and reproduce

Running the build in a github actions runner with service account exits because the CLI is not signed in

Expected behavior

The application being built and deployed

Actual behavior

The deploy command exits before building the app

zal1000 avatar Aug 20 '22 15:08 zal1000

This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Aug 20 '22 15:08 google-oss-bot

Working in @angular/[email protected] & [email protected]:

  1. Add this auth step before your deploy command using the secret generated by % firebase init hosting:github; use the output for the FIREBASE_TOKEN env variable:
- id:   auth
  uses: google-github-actions/auth@v1
  with:
    credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_PROJECT_XYZ }}
    token_format:     access_token
- run:  ng deploy
  env:
    FIREBASE_TOKEN: ${{ steps.auth.outputs.access_token }}
  1. Add gha-creds-*.json to your .gitignore file.
  2. In IAM & Admin, grant Service Account Token Creator to the GitHub Actions principal:
Screenshot 2023-06-03 at 21 36 07

gavinsawyer avatar Jun 04 '23 01:06 gavinsawyer