Skip to content

Commit

Permalink
update wrokflow (#8)
Browse files Browse the repository at this point in the history
* update workflow
  • Loading branch information
SakinduRansindu authored Nov 14, 2024
1 parent 963f3ef commit 0792d8f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
34 changes: 18 additions & 16 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
@@ -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 merge
on:
push:
Expand All @@ -9,24 +6,29 @@ on:
jobs:
build_and_deploy:
runs-on: ubuntu-latest
env: # Set environment variables at the job level
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 }}
NEXT_PUBLIC_STATUS: ${{ secrets.NEXT_PUBLIC_STATUS }}

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"

- run: npm ci && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
- name: Verify environment variables
run: echo "NEXT_PUBLIC_STATUS is set to: ${NEXT_PUBLIC_STATUS}"

- name: Install dependencies and build
run: npm ci && npm run build

- name: Deploy to Firebase Hosting
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_FIRETEST_C524F }}
channelId: live
projectId: firetest-c524f
projectId: firetest-c524f
22 changes: 9 additions & 13 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -11,19 +8,18 @@ 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 }}
NEXT_PUBLIC_STATUS: $${{ secrets.NEXT_PUBLIC_STATUS }}

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: Install dependencies and build
run: npm ci && npm run build
Expand Down
4 changes: 3 additions & 1 deletion src/services/firebaseConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ const firebaseConfig = {
projectId: process.env.NEXT_PUBLIC_PROJECT_ID,
storageBucket: process.env.NEXT_PUBLIC_STORAGE_BUCKET,
messagingSenderId: process.env.NEXT_PUBLIC_MESSAGING_SENDER_ID,
appId: process.env.NEXT_PUBLIC_APP_ID
appId: process.env.NEXT_PUBLIC_APP_ID,
status: process.env.NEXT_PUBLIC_STATUS
};

console.log(firebaseConfig.apiKey===undefined?'firebase configurations missing':'firebase configuration found 🔥🔥');
console.log('api keys status ',firebaseConfig.status);
// Initialize Firebase
export const app = initializeApp(firebaseConfig);

0 comments on commit 0792d8f

Please sign in to comment.