From 5e8ba4089222747f5d4e84d80d13f991b64f689a Mon Sep 17 00:00:00 2001 From: vinicius-dz <150390785+vinicius-dz@users.noreply.github.com> Date: Thu, 18 Jan 2024 17:49:51 -0300 Subject: [PATCH 1/7] update to node 18 (#1) --- Dockerfile | 2 +- README.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7532a3ea..e4fe5dc9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14-slim +FROM node:18-slim RUN npm install -g firebase-tools COPY entrypoint.sh /usr/local/bin ENTRYPOINT ["entrypoint.sh"] diff --git a/README.md b/README.md index f1f79932..922f2e6c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Deploy to Firebase Functions for Node14 +# Deploy to Firebase Functions for Node18 -A GitHub Action to deploy to Firebase Cloud Functions for Node14. +A GitHub Action to deploy to Firebase Cloud Functions 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 @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: jsryudev/deploy-firebase-functions@v0.0.2 + - uses: dayzero-eng/deploy-firebase-functions@v0.0.1 env: FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} FIREBASE_PROJECT: firebase-project-id @@ -43,7 +43,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: jsryudev/deploy-firebase-functions@v0.0.2 + - uses: dayzero-eng/deploy-firebase-functions@v0.0.2 env: FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} FIREBASE_PROJECT: firebase-project-id From 7a9f3ad836d4f1f25a30590cd75546a05b63933a Mon Sep 17 00:00:00 2001 From: vinicius-dz <150390785+vinicius-dz@users.noreply.github.com> Date: Thu, 18 Jan 2024 18:02:57 -0300 Subject: [PATCH 2/7] update deploy script (#2) Signed-off-by: Vinicius Tosta --- entrypoint.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 32bdfeb9..d065d232 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -15,4 +15,3 @@ fi firebase deploy \ -m "${GITHUB_REF} (${GITHUB_SHA})" \ --project ${FIREBASE_PROJECT} \ - --only functions From a3c0b464976d93ea5d2799f66c7606335f9cbbcc Mon Sep 17 00:00:00 2001 From: vinicius-dz <150390785+vinicius-dz@users.noreply.github.com> Date: Thu, 18 Jan 2024 18:20:33 -0300 Subject: [PATCH 3/7] Update entrypoint.sh --- entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index d065d232..3070503c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -12,6 +12,8 @@ if [ -z "${FIREBASE_PROJECT}" ]; then exit 1 fi +firebase experiments:enable webframeworks + firebase deploy \ -m "${GITHUB_REF} (${GITHUB_SHA})" \ --project ${FIREBASE_PROJECT} \ From 75a4134ec8429a9d2889b00502f8b7093537636b Mon Sep 17 00:00:00 2001 From: vinicius-dz <150390785+vinicius-dz@users.noreply.github.com> Date: Thu, 18 Jan 2024 18:34:51 -0300 Subject: [PATCH 4/7] update entrypoint script (#3) Signed-off-by: Vinicius Tosta --- entrypoint.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 3070503c..8f3d2204 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,7 @@ #!/bin/bash +npm install + cd functions; npm install if [ -z "${FIREBASE_TOKEN}" ]; then @@ -12,6 +14,8 @@ if [ -z "${FIREBASE_PROJECT}" ]; then exit 1 fi +cd .. + firebase experiments:enable webframeworks firebase deploy \ From 821a1e2d0d3983e3db6ecf04001feb991a6c6abd Mon Sep 17 00:00:00 2001 From: vinicius-dz <150390785+vinicius-dz@users.noreply.github.com> Date: Fri, 19 Jan 2024 10:55:41 -0300 Subject: [PATCH 5/7] update project metadata and release versions (#4) Signed-off-by: Vinicius Tosta --- Makefile | 2 +- README.md | 8 ++++---- action.yml | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 3c565327..ecb4c287 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,2 @@ build: - docker build . -t jsryudev/deploy-firebase-functions + docker build . -t dayzero-eng/deploy-firebase-functions diff --git a/README.md b/README.md index 922f2e6c..09a9c639 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Deploy to Firebase Functions for Node18 +# Deploy to Firebase for Node18 -A GitHub Action to deploy to Firebase Cloud Functions for Node18. +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 @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: dayzero-eng/deploy-firebase-functions@v0.0.1 + - uses: dayzero-eng/deploy-firebase-functions@v0.0.5 env: FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} FIREBASE_PROJECT: firebase-project-id @@ -43,7 +43,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: dayzero-eng/deploy-firebase-functions@v0.0.2 + - uses: dayzero-eng/deploy-firebase-functions@v0.0.5 env: FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} FIREBASE_PROJECT: firebase-project-id diff --git a/action.yml b/action.yml index 1e60e5cf..e62073f9 100644 --- a/action.yml +++ b/action.yml @@ -1,6 +1,6 @@ -name: 'Deploy to Firebase Cloud Functions' -author: 'jsryudev ' -description: 'A GitHub Action to deploy to Firebase Cloud Functions' +name: 'Deploy to Firebase' +author: 'dayzero-eng' +description: 'A GitHub Action to deploy to Firebase' runs: using: 'docker' image: 'Dockerfile' From 82b0a90cad9c5e021fec3b068086d2542a0e61ef Mon Sep 17 00:00:00 2001 From: vinicius-dz <150390785+vinicius-dz@users.noreply.github.com> Date: Fri, 2 Feb 2024 15:47:25 -0300 Subject: [PATCH 6/7] include GOOGLE_APPLICATION_CREDENTIALS check (#5) 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 From 93c9f43c138c8efdc1b939f2fa777ff09097523c Mon Sep 17 00:00:00 2001 From: Dheshal Jayamanne Date: Sun, 4 Feb 2024 13:35:07 +0530 Subject: [PATCH 7/7] Update Dockerfile Node version set to a dynamic value `current-slim`, making the github action last a century without trouble, hehe. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e4fe5dc9..6ebbb7fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:18-slim +FROM node:current-slim RUN npm install -g firebase-tools COPY entrypoint.sh /usr/local/bin ENTRYPOINT ["entrypoint.sh"]