Skip to content

Merge pull request #152 from Justin-MacIntosh/screener-frontend-ts #3

Merge pull request #152 from Justin-MacIntosh/screener-frontend-ts

Merge pull request #152 from Justin-MacIntosh/screener-frontend-ts #3

name: Build and Deploy to Firebase Hosting
on:
push:
branches:
- main
paths:
- 'screener-frontend/**'
env:
PROJECT_ID: 'benefit-decision-toolkit-play'
WORKLOAD_IDENTITY_PROVIDER: 'projects/1034049717668/locations/global/workloadIdentityPools/github-actions-google-cloud/providers/github'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
# Add these permissions for Workload Identity Federation
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Configure Workload Identity Federation and generate an access token.
#
# See https://github.com/google-github-actions/auth for more options,
# including authenticating via a JSON credentials file.
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: '${{ env.WORKLOAD_IDENTITY_PROVIDER }}'
service_account: cicd-build-deploy-api@benefit-decision-toolkit-play.iam.gserviceaccount.com
project_id: ${{ env.PROJECT_ID }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Cache node modules
uses: actions/cache@v3
with:
path: screener-frontend/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('screener-frontend/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
cache: 'npm'
cache-dependency-path: 'screener-frontend/package-lock.json'
- name: Install dependencies
working-directory: screener-frontend
run: npm ci
- name: Build application
working-directory: screener-frontend
run: npm run build
env:
VITE_API_URL: ${{ secrets.VITE_SCREENER_API_URL}}
- name: Install Firebase CLI
run: npm install -g firebase-tools
- name: Deploy to Firebase Hosting
run: firebase deploy --only hosting:screener-frontend