Skip to content

Commit

Permalink
YML files for forntend prod deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
yevkim committed Dec 29, 2024
1 parent fc608d1 commit 901286d
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 13 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/firebase-hosting-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy Frontend to Firebase Hosting PROD
on:
workflow_dispatch:
jobs:
build_and_deploy:
runs-on: ubuntu-latest
environment: prod
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Cache Next.js build
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/frontend/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies and build
env:
APP_ENV: prod
NEXT_PUBLIC_API_BASE_URL: ${{ vars.NEXT_PUBLIC_API_BASE_URL }}
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ vars.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}
NEXT_PUBLIC_FIREBASE_API_KEY: ${{ vars.NEXT_PUBLIC_FIREBASE_API_KEY }}
NEXT_PUBLIC_FIREBASE_PROJECT_ID: ${{ vars.NEXT_PUBLIC_FIREBASE_PROJECT_ID }}
NEXT_PUBLIC_FIREBASE_APP_ID: ${{ vars.NEXT_PUBLIC_FIREBASE_APP_ID }}
run: |
cd frontend
npm ci
npm install sharp
npm run build
- name: Debug Variables
run: |
echo "Using vars context: ${{ vars.NEXT_PUBLIC_API_BASE_URL }}"
echo "Current branch: ${{ github.ref_name }}"
echo "All environment variables:"
env
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_SCHEMESSG_V3_PROD }}
channelId: live
projectId: schemessg
target: prod
entryPoint: ./frontend
env:
FIREBASE_CLI_EXPERIMENTS: webframeworks
NEXT_PUBLIC_API_BASE_URL: ${{ vars.NEXT_PUBLIC_API_BASE_URL }}
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ vars.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}
NEXT_PUBLIC_FIREBASE_API_KEY: ${{ vars.NEXT_PUBLIC_FIREBASE_API_KEY }}
NEXT_PUBLIC_FIREBASE_PROJECT_ID: ${{ vars.NEXT_PUBLIC_FIREBASE_PROJECT_ID }}
NEXT_PUBLIC_FIREBASE_APP_ID: ${{ vars.NEXT_PUBLIC_FIREBASE_APP_ID }}
12 changes: 10 additions & 2 deletions frontend/.firebaserc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"projects": {
"default": "schemessg-v3-dev"
"default": "schemessg-v3-dev",
"prod": "schemessg"
},
"targets": {
"schemessg-v3-dev": {
Expand All @@ -9,8 +10,15 @@
"schemessg-v3-dev"
]
}
},
"schemessg": {
"hosting": {
"prod": [
"schemessg"
]
}
}
},
"etags": {},
"dataconnectEmulatorConfig": {}
}
}
36 changes: 25 additions & 11 deletions frontend/firebase.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
{
"hosting": [{
"target": "staging",
"source": ".",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"frameworksBackend": {
"region": "asia-east1"
"hosting": [
{
"target": "staging",
"source": ".",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"frameworksBackend": {
"region": "asia-southeast1"
}
},
{
"target": "prod",
"source": ".",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"frameworksBackend": {
"region": "asia-southeast1"
}
}
}]
]
}

0 comments on commit 901286d

Please sign in to comment.