Skip to content

Commit

Permalink
Merge with main
Browse files Browse the repository at this point in the history
  • Loading branch information
mraysu committed Feb 14, 2024
2 parents 08f35e6 + 3be3c33 commit 781c02e
Show file tree
Hide file tree
Showing 27 changed files with 395 additions and 163 deletions.
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "pia-dev-60cea"
}
}
50 changes: 50 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build and Deploy

on:
workflow_call:
inputs:
environment:
required: true
type: string
firebaseProjectId:
required: true
type: string
firebaseHostingChannelId:
required: false
type: string

jobs:
build_and_preview:
name: Build and Deploy
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Create Frontend .env
run: |
cd frontend
touch .env
echo FIREBASE_CONFIG=${{ secrets.FIREBASE_CONFIG }} >> .env
- name: Create Backend .env
run: |
cd backend
touch .env
echo MONGO_URI=${{ secrets.MONGO_URI }} >> .env
echo SERVICE_ACCOUNT_KEY=${{ secrets.SERVICE_ACCOUNT_KEY }} >> .env
echo APP_PORT=${{ secrets.APP_PORT }} >> .env
- name: Build Frontend
run: cd frontend && npm ci && npm run build
- name: Build Backend
run: |
cd backend
npm run build
- name: Deploy to Firebase
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_PIA_DEV_60CEA }}"
projectId: ${{ inputs.firebaseProjectId }}
channelId: ${{ inputs.firebaseHostingChannelId }}
env:
FIREBASE_CLI_EXPERIMENTS: pintags
13 changes: 13 additions & 0 deletions .github/workflows/preview-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Deploy Branch Preview
on:
pull_request:

jobs:
deploy_preview:
name: Deploy Branch Preview
if: "${{ github.event.pull_request.head.repo.full_name == github.repository }}"
uses: ./.github/workflows/build-and-deploy.yml
with:
environment: Preview
firebaseProjectId: pia-dev-60cea
secrets: inherit
15 changes: 15 additions & 0 deletions .github/workflows/staging-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Deploy to Staging
on:
push:
branches:
- main

jobs:
deploy_staging:
name: Deploy to Staging
uses: ./.github/workflows/build-and-deploy.yml
with:
environment: Staging
firebaseProjectId: pia-dev-60cea
firebaseHostingChannelId: live
secrets: inherit
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,6 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# Firebase
.firebase
Loading

0 comments on commit 781c02e

Please sign in to comment.