From d47e715a0d996c17594fb899ee88cfc1a6f237e3 Mon Sep 17 00:00:00 2001 From: Sakindu Ransindu Date: Thu, 14 Nov 2024 08:36:32 +0530 Subject: [PATCH] update workflow --- .../firebase-hosting-pull-request.yml | 22 +++++++++---------- src/services/firebaseConfig.ts | 2 +- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index ef05692..c6449bc 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -1,6 +1,3 @@ -# This file was auto-generated by the Firebase CLI -# https://github.com/firebase/firebase-tools - name: Deploy to Firebase Hosting on PR on: pull_request permissions: @@ -11,19 +8,20 @@ jobs: build_and_preview: if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} runs-on: ubuntu-latest + env: + NEXT_PUBLIC_API_KEY: ${{ secrets.NEXT_PUBLIC_API_KEY }} + NEXT_PUBLIC_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_AUTH_DOMAIN }} + NEXT_PUBLIC_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_PROJECT_ID }} + NEXT_PUBLIC_STORAGE_BUCKET: ${{ secrets.NEXT_PUBLIC_STORAGE_BUCKET }} + NEXT_PUBLIC_MESSAGING_SENDER_ID: ${{ secrets.NEXT_PUBLIC_MESSAGING_SENDER_ID }} + NEXT_PUBLIC_APP_ID: ${{ secrets.NEXT_PUBLIC_APP_ID }} + steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set environment variables - env: - NEXT_PUBLIC_API_KEY: ${{ secrets.NEXT_PUBLIC_API_KEY }} - NEXT_PUBLIC_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_AUTH_DOMAIN }} - NEXT_PUBLIC_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_PROJECT_ID }} - NEXT_PUBLIC_STORAGE_BUCKET: ${{ secrets.NEXT_PUBLIC_STORAGE_BUCKET }} - NEXT_PUBLIC_MESSAGING_SENDER_ID: ${{ secrets.NEXT_PUBLIC_MESSAGING_SENDER_ID }} - NEXT_PUBLIC_APP_ID: ${{ secrets.NEXT_PUBLIC_APP_ID }} - run: echo "Environment variables set" + - name: Verify environment variables + run: echo "NEXT_PUBLIC_API_KEY is set to: ${NEXT_PUBLIC_API_KEY:0:4}****" - name: Install dependencies and build run: npm ci && npm run build diff --git a/src/services/firebaseConfig.ts b/src/services/firebaseConfig.ts index fbfeb52..318d82f 100644 --- a/src/services/firebaseConfig.ts +++ b/src/services/firebaseConfig.ts @@ -13,6 +13,6 @@ const firebaseConfig = { appId: process.env.NEXT_PUBLIC_APP_ID }; -console.log(firebaseConfig.apiKey===undefined?'firebase configurations missing':'firebase configuration found 🔥🔥'); +console.log(firebaseConfig.apiKey && firebaseConfig.apiKey===undefined?'firebase configurations missing':'firebase configuration found 🔥🔥'); // Initialize Firebase export const app = initializeApp(firebaseConfig); \ No newline at end of file