Skip to content

use node 20 for building #133

use node 20 for building

use node 20 for building #133

name: Deploy to Firebase Hosting on merge
'on':
push:
branches:
- main
jobs:
build_and_deploy:
name: Build App and Deploy to Firebase Hosting
runs-on: ubuntu-latest
steps:
- name: Calculate Short SHA for REACT_APP_RELEASE_VERSION
run: echo "SHORT_SHA=`echo ${GITHUB_SHA::7}`" >> $GITHUB_ENV
- name: Check out code
uses: actions/checkout@v3
- name: Set Node.js 20.x
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Create .env file
uses: SpicyPizza/create-envfile@v1.3.1
with:
envkey_REACT_APP_GMAP_JS_API_KEY: ${{ secrets.GMAP_JS_API_KEY }}
envkey_REACT_APP_FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }}
envkey_REACT_APP_FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
envkey_REACT_APP_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.FIREBASE_MESSAGING_SENDER_ID }}
envkey_REACT_APP_FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }}
envkey_REACT_APP_FIREBASE_AUTH_DOMAIN: ${{ secrets.FIREBASE_AUTH_DOMAIN }}
envkey_REACT_APP_SIMPLE_ANALYTICS_URL: ${{ secrets.SIMPLE_ANALYTICS_URL }}
envkey_REACT_APP_SIMPLE_ANALYTICS_PIXEL_URL: ${{ secrets.SIMPLE_ANALYTICS_PIXEL_URL }}
envkey_REACT_APP_HCAPTCHA_SITE_KEY: ${{ secrets.HCAPTCHA_SITE_KEY }}
envkey_REACT_APP_RAPIDAPI_KEY: ${{ secrets.RAPIDAPI_KEY }}
envkey_NODE_ENV: 'production'
envkey_REACT_APP_RELEASE_VERSION: ${SHORT_SHA}
- name: install yarn dependencies
uses: borales/actions-yarn@v4.2.0
with:
cmd: install --frozen-lockfile
- name: create production build
uses: borales/actions-yarn@v4.2.0
with:
cmd: build
- name: deploy production build to Firebase Hosting
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_LETS_PLAN_FIREBASE }}'
channelId: live
projectId: lets-plan-firebase