Skip to content

Commit

Permalink
Merge pull request #14 from yun-cheng/chore/firebase-deployment
Browse files Browse the repository at this point in the history
chore(deploy): configure GitHub Actions for automatic deployment to Firebase Hosting
  • Loading branch information
yun-cheng authored Mar 22, 2024
2 parents b022dba + 1fd91b7 commit 68af1cc
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "aha-frontend-assessment"
}
}
27 changes: 27 additions & 0 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- run: pnpm install && pnpm build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_AHA_FRONTEND_ASSESSMENT }}'
channelId: live
projectId: aha-frontend-assessment
28 changes: 28 additions & 0 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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:
checks: write
contents: read
pull-requests: write
jobs:
build_and_preview:
if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- run: pnpm install && pnpm build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_AHA_FRONTEND_ASSESSMENT }}'
projectId: aha-frontend-assessment
12 changes: 12 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"hosting": {
"public": "dist",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
2 changes: 1 addition & 1 deletion src/components/common/NavBar/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useAtom } from 'jotai'
import { useEffect, type ReactElement } from 'react'
import { Link, useLocation } from 'react-router-dom'
import cn from 'utils/cn'
import ArrowBackSvg from '../../../icons/arrowBack.svg?react'
import ArrowBackSvg from '../../../icons/ArrowBack.svg?react'
import Logo from '../Logo'
import NavButton from './NavButton'

Expand Down
2 changes: 1 addition & 1 deletion src/pages/ResultsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useEffect, useRef, type ReactElement } from 'react'
import { useInView } from 'react-intersection-observer'
import { Link } from 'react-router-dom'
import cn from 'utils/cn'
import ArrowBackSvg from '../icons/arrowBack.svg?react'
import ArrowBackSvg from '../icons/ArrowBack.svg?react'

export default function ResultsPage(): ReactElement {
const containerRef = useRef<HTMLDivElement>(null)
Expand Down

0 comments on commit 68af1cc

Please sign in to comment.