Skip to content

actions: screener-frontend t1 #1

actions: screener-frontend t1

actions: screener-frontend t1 #1

# This workflow uses devbox for dependency management and builds/deploys the screener frontend
# to Firebase Hosting when a commit is pushed to the "main" branch.
name: 'Build and Deploy Screener Frontend to Firebase Hosting'
on:
push:
branches:
- 157-offline-dev
paths:
- 'screener-frontend/**'
- 'devbox.json'
- 'devbox.lock'
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
# Devbox needs a .env file to exist, even if it's empty
- name: 'Create .env file'
run: touch .env
# Setup devbox which includes Node.js, Firebase CLI, and Google Cloud SDK
- name: 'Install devbox'
uses: 'jetify-com/[email protected]'
with:
enable-cache: true
# Configure Workload Identity Federation and generate an access token
- 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: Cache node modules
uses: actions/cache@v4
with:
path: screener-frontend/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('screener-frontend/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
working-directory: screener-frontend
run: devbox run install-screener-frontend-ci
- name: Build application
working-directory: screener-frontend
run: devbox run build-screener-frontend-ci
env:
VITE_API_URL: ${{ secrets.VITE_SCREENER_API_URL}}
- name: Deploy to Firebase Hosting
run: devbox run -- firebase deploy --only hosting:screener-frontend