1+ # This workflow uses devbox for dependency management and builds/deploys the screener frontend
2+ # to Firebase Hosting when a commit is pushed to the "main" branch.
3+
4+ name : ' Build and Deploy Screener Frontend to Firebase Hosting'
5+
6+ on :
7+ push :
8+ branches :
9+ - 157-offline-dev
10+ paths :
11+ - ' screener-frontend/**'
12+ - ' devbox.json'
13+ - ' devbox.lock'
14+
15+ env :
16+ PROJECT_ID : ' benefit-decision-toolkit-play'
17+ WORKLOAD_IDENTITY_PROVIDER : ' projects/1034049717668/locations/global/workloadIdentityPools/github-actions-google-cloud/providers/github'
18+
19+ jobs :
20+ build-and-deploy :
21+ runs-on : ubuntu-latest
22+
23+ # Add these permissions for Workload Identity Federation
24+ permissions :
25+ contents : read
26+ id-token : write
27+
28+ steps :
29+ - name : Checkout repository
30+ uses : actions/checkout@v4
31+
32+ # Devbox needs a .env file to exist, even if it's empty
33+ - name : ' Create .env file'
34+ run : touch .env
35+
36+ # Setup devbox which includes Node.js, Firebase CLI, and Google Cloud SDK
37+ - name : ' Install devbox'
38+ uses :
' jetify-com/[email protected] ' 39+ with :
40+ enable-cache : true
41+
42+ # Configure Workload Identity Federation and generate an access token
43+ - id : ' auth'
44+ name : ' Authenticate to Google Cloud'
45+ uses : ' google-github-actions/auth@v2'
46+ with :
47+ workload_identity_provider : ' ${{ env.WORKLOAD_IDENTITY_PROVIDER }}'
48+ service_account : cicd-build-deploy-api@benefit-decision-toolkit-play.iam.gserviceaccount.com
49+ project_id : ${{ env.PROJECT_ID }}
50+
51+ - name : Cache node modules
52+ uses : actions/cache@v4
53+ with :
54+ path : screener-frontend/node_modules
55+ key : ${{ runner.os }}-node-${{ hashFiles('screener-frontend/package-lock.json') }}
56+ restore-keys : |
57+ ${{ runner.os }}-node-
58+
59+ - name : Install dependencies
60+ working-directory : screener-frontend
61+ run : devbox run install-screener-frontend-ci
62+
63+ - name : Build application
64+ working-directory : screener-frontend
65+ run : devbox run build-screener-frontend-ci
66+ env :
67+ VITE_API_URL : ${{ secrets.VITE_SCREENER_API_URL}}
68+
69+ - name : Deploy to Firebase Hosting
70+ run : devbox run -- firebase deploy --only hosting:screener-frontend
0 commit comments