From 84b58c4e0da1b9414ca4f6b01b8b822aa0c92afe Mon Sep 17 00:00:00 2001 From: Vinicius Tosta Date: Fri, 2 Feb 2024 15:43:06 -0300 Subject: [PATCH] include GOOGLE_APPLICATION_CREDENTIALS check Signed-off-by: Vinicius Tosta --- README.md | 2 ++ entrypoint.sh | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 09a9c639..49f7ee88 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ A GitHub Action to deploy to Firebase for Node18. - Make sure that you checkout the repository using the [actions/checkout](https://github.com/actions/checkout) action - Make sure that you have the `firebase.json` file in the repository - To obtain the Firebase token, run `firebase login:ci` on your local computer and [store the token](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository) as the `FIREBASE_TOKEN` secret +- To obtain service account credentials, get the service account JSON file from Firebase console and set its path to `GOOGLE_APPLICATION_CREDENTIALS` +- Either `FIREBASE_TOKEN` or `GOOGLE_APPLICATION_CREDENTIALS` are required to deploy the project. No need to set both at the same time. - Specify the Firebase project name in the `FIREBASE_PROJECT` env var ## Workflow examples diff --git a/entrypoint.sh b/entrypoint.sh index 8f3d2204..b3540b96 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -4,8 +4,8 @@ npm install cd functions; npm install -if [ -z "${FIREBASE_TOKEN}" ]; then - echo "FIREBASE_TOKEN is missing" +if [[ -z "${FIREBASE_TOKEN}" && -z "${GOOGLE_APPLICATION_CREDENTIALS}" ]]; then + echo "Access tokens are missing! Provide either FIREBASE_TOKEN or GOOGLE_APPLICATION_CREDENTIALS" exit 1 fi