Skip to content

Merge pull request #173 from marvelai-org/Ahmedr275-patch-1 #47

Merge pull request #173 from marvelai-org/Ahmedr275-patch-1

Merge pull request #173 from marvelai-org/Ahmedr275-patch-1 #47

# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools
name: Deploy to Firebase Hosting on merge
on:
push:
branches:
- main
- develop
jobs:
build_and_deploy_sandbox:
name: "Deploy to Marvel Develop"
if: ${{ github.ref == 'refs/heads/develop' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "18.17.0"
- name: Install Firebase CLI
run: |
npm install -g firebase-tools
- name: Install Functions Dependencies
run: |
cd functions
npm install
- name: Decode Base64 Env Vars for Develop
if: github.ref == 'refs/heads/develop'
run: |
cd functions
echo "${{ secrets.SANDBOX_ENV_FILE_BASE64 }}" | base64 --decode > .env
- name: Deploy Functions to Develop
if: github.ref == 'refs/heads/develop'
run: |
set -o allexport
source functions/.env
set +o allexport
firebase deploy --only functions --force --token ${{ secrets.FIREBASE_TOKEN }} --project kai-platform-sandbox
- name: Decode and create .env file from secret
run: |
echo "${{ secrets.SANDBOX_ENV_FILE_BASE64 }}" | base64 --decode > .env
- name: Set environment variables
run: |
set -a
source .env
set +a
- name: Install Next.js globally
run: npm install -g next
- name: Build Next.js
run: npm run build:next
- name: Set Channel ID
id: set_channel_id
run: |
if [ "${{ github.event_name }}" = "push" ]; then
echo "channel_id=live" >> $GITHUB_ENV
else
echo "channel_id=pr-${{ github.event.pull_request.number }}" >> $GITHUB_ENV
fi
- name: Deploy to Firebase
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GIT_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_SANDBOX }}
projectId: kai-platform-sandbox
channelId: ${{ env.channel_id }}
build_and_deploy_production:
name: "Deploy to Marvel Production"
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "18.17.0"
- name: Install Firebase CLI
run: |
npm install -g firebase-tools
- name: Install Functions Dependencies
run: |
cd functions
npm install
- name: Decode Base64 Env Vars for Specific Branches
if: github.ref == 'refs/heads/main'
run: |
cd functions
echo "${{ secrets.PROD_ENV_FILE_BASE64 }}" | base64 --decode > .env
- name: Deploy Functions to Production
if: github.ref == 'refs/heads/main'
run: |
set -o allexport
source functions/.env
set +o allexport
firebase deploy --only functions --force --token ${{ secrets.FIREBASE_TOKEN }} --project kai-ai-f63c8
- name: Decode and create .env file from secret
run: |
echo "${{ secrets.PROD_ENV_FILE_BASE64 }}" | base64 --decode > .env
- name: Set environment variables
run: |
set -a
source .env
set +a
- name: Install Next.js globally
run: npm install -g next
- name: Build Next.js
run: npm run build:next
- name: Set Channel ID
id: set_channel_id
run: |
if [ "${{ github.event_name }}" = "push" ]; then
echo "channel_id=live" >> $GITHUB_ENV
else
echo "channel_id=pr-${{ github.event.pull_request.number }}" >> $GITHUB_ENV
fi
- name: Deploy to Firebase
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GIT_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_KAI_AI_F63C8 }}
projectId: kai-ai-f63c8
channelId: ${{ env.channel_id }}