enable firebase previews for pr

This commit is contained in:
Raymond Wang 2022-10-24 20:55:17 -07:00
parent 14633ea47d
commit 43459b778f
4 changed files with 35 additions and 12 deletions

1
.firebaserc Normal file
View file

@ -0,0 +1 @@
{}

View file

@ -6,13 +6,6 @@ name: build-page-branch
on:
push:
branches: [main]
# The below rule invokes when ANY pull request is made to main
# This is DANGEROUS and can allow for malicious behavior
# pull_request:
# branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
@ -20,19 +13,18 @@ jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Use production environment specified in GitHub settings
environment: production
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-node@v3.0.0
- uses: actions/setup-node@v3
with:
node-version: 16
# Builds the react site for github pages
- name: Build Static Pages
run: |
npm i
rm .gitignore
npm ci
npm run build
mv CNAME build/public
mv build/public docs

20
.github/workflows/preview.yml vendored Normal file
View file

@ -0,0 +1,20 @@
name: deploy-preview
on: pull_request
jobs:
build_and_preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 16
- run: |
npm ci
npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"
projectId: ieeeucsd-org

10
firebase.json Normal file
View file

@ -0,0 +1,10 @@
{
"hosting": {
"public": "build/public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}