Hosting static website like react app from the google bucket is very well described here
Unfortunatelly we need to have Cloud Load Balancing service enabled to make it working. To be validated This makes the hosting on GCP not cost effective
yarn build
gsutil rsync -R ./build gs://pttechbricksweb/
https://hackernoon.com/how-to-deploy-a-react-application-with-firebase-hosting-p92m37b7
yarn install firebase-tools
firebase login
yarn build
firebase init
? What do you want to use as your public directory? - build
Configure as a single-page app (rewrite all urls to /index.html)?
Set up automatic builds and deploys with GitHub? - Y
? File build/index.html already exists. Overwrite? (y/N) - N
? Set up the workflow to run a build script before every deploy? (y/N) - y
? What script should be run before every deploy? (npm ci && npm run build) - yarn install && yarn build
firebase deploy
By default github treats warning as errors and fails during build. For our projects let us ignore it with env: CI
environment variable
name: Deploy to Firebase Hosting on PR
env:
CI: false
'on': pull_request
jobs:
build_and_preview:
if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: yarn install && yarn build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_PTTECHBRICKSAPI_347809 }}'
projectId: pttechbricksapi-347809