Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy not working with service account in github actions #3260

Closed
zal1000 opened this issue Aug 20, 2022 · 2 comments
Closed

Deploy not working with service account in github actions #3260

zal1000 opened this issue Aug 20, 2022 · 2 comments

Comments

@zal1000
Copy link
Contributor

zal1000 commented Aug 20, 2022

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

@google-oss-bot
Copy link

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

zal1000 added a commit to zal1000/angularfire that referenced this issue Aug 20, 2022
Deploying with service account was not possible, becouse no checks were made for
GOOGLE_APPLICATION_CREDENTIALS env variable

Fixes angular#3260
zal1000 added a commit to zal1000/angularfire that referenced this issue Aug 20, 2022
Service account was not activated before deploying

Fixes angular#3260
@gavinsawyer
Copy link

gavinsawyer commented Jun 4, 2023

Working in @angular/fire@7.6.1 & firebase-tools@12.3.0:

  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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants