GitHub Actions workflows, automation scripts, and CI/CD pipelines for DiagnosticPro.
This directory contains all GitHub Actions workflows and automation scripts for continuous integration, deployment, and security management.
.github/
βββ workflows/ # GitHub Actions workflow definitions
β βββ ci.yml # CI/CD pipeline (tests, builds, validation)
β βββ deploy-cloudrun.yml # Cloud Run deployment with WIF
βββ scripts/ # Automation scripts
βββ ISSUE_TEMPLATE/ # Issue templates
βββ CODEOWNERS # Code ownership rules
βββ README.md # This file
Trigger: Push or PR to main branch
Jobs:
-
frontend-test- Test and build React frontend- Install dependencies
- Run Jest tests
- Build production bundle
-
backend-test- Validate backend services- Install dependencies
- Verify PDF generator
- Check Node.js compatibility
-
firebase-functions-test- Test Firebase Functions- Install dependencies
- Build TypeScript functions
- Verify deployment readiness
Status: β Active
Trigger:
- Push to
mainbranch (automatic) - Manual trigger via
workflow_dispatch
Authentication: Workload Identity Federation (WIF) - Keyless authentication
Configuration:
Workload Identity Provider:
projects/298932670545/locations/global/workloadIdentityPools/github-actions-pool/providers/github-provider
Service Account:
github-actions-deployer@diagnostic-pro-prod.iam.gserviceaccount.com
Permissions:
- roles/run.admin
- roles/secretmanager.secretAccessor
- roles/iam.serviceAccountUserDeployment Steps:
- Authenticate to Google Cloud via OIDC (no keys required)
- Set up Cloud SDK
- Deploy backend to Cloud Run with:
- Source:
./02-src/backend/services/backend - Region:
us-central1 - Secrets from Google Secret Manager:
STRIPE_SECRET_KEYSTRIPE_WEBHOOK_SECRETFIREBASE_API_KEY
- Auto-scaling: 0-10 instances
- Resources: 512Mi RAM, 1 CPU
- Timeout: 540s
- Source:
Status: β Active
Manual Trigger:
# Via GitHub UI
1. Go to Actions tab
2. Select "Deploy to Cloud Run"
3. Click "Run workflow"
# Via GitHub CLI
gh workflow run deploy-cloudrun.ymlWhy WIF?
- β No service account JSON keys in GitHub secrets
- β Short-lived tokens (auto-expiring)
- β Keyless authentication
- β Fine-grained IAM permissions
- β Audit logging
Setup Details:
- Pool:
github-actions-pool - Provider:
github-provider(OIDC) - Issuer:
https://token.actions.githubusercontent.com - Condition:
assertion.repository_owner=='jeremylongshore'
Service Account Roles:
github-actions-deployer@diagnostic-pro-prod.iam.gserviceaccount.com
βββ roles/iam.workloadIdentityUser
βββ roles/run.admin
βββ roles/secretmanager.secretAccessor
βββ roles/iam.serviceAccountUser
Secrets Stored:
FIREBASE_API_KEY- Firebase authenticationAPI_GATEWAY_KEY- API Gateway accessSTRIPE_SECRET_KEY- Stripe payment processingSTRIPE_WEBHOOK_SECRET- Stripe webhook verification
Runtime Injection: Secrets are injected into Cloud Run at deployment time using:
--set-secrets="SECRET_NAME=SECRET_NAME:latest"Backend application fetches secrets via @google-cloud/secret-manager SDK with 1-hour caching.
Currently contains README placeholder for future automation scripts:
- Audit automation (planned)
- Maintenance automation (planned)
- Release automation (planned)
Frontend Tests:
cd 02-src/frontend
npm ci
npm test
npm run buildBackend Validation:
cd 02-src/backend/services/backend
npm ci
node -e "const {generateDiagnosticProPDF} = require('./reportPdfProduction.js'); console.log('PDF generator loaded');"Firebase Functions:
cd functions
npm ci
npm run buildAutomatic Deployment:
Push to main branch triggers automatic deployment via GitHub Actions.
Manual Deployment:
# Using gcloud CLI
gcloud run deploy diagnosticpro-vertex-ai-backend \
--source ./02-src/backend/services/backend \
--region us-central1 \
--project diagnostic-pro-prod \
--set-secrets="STRIPE_SECRET_KEY=STRIPE_SECRET_KEY:latest,STRIPE_WEBHOOK_SECRET=STRIPE_WEBHOOK_SECRET:latest,FIREBASE_API_KEY=FIREBASE_API_KEY:latest"
# Or trigger GitHub Actions workflow
gh workflow run deploy-cloudrun.ymlView workflow runs:
- Web: https://github.com/jeremylongshore/DiagnosticPro/actions
- CLI:
gh run list
# Cloud Run logs
gcloud logging read "resource.type=\"cloud_run_revision\" \
AND resource.labels.service_name=\"diagnosticpro-vertex-ai-backend\"" \
--project diagnostic-pro-prod \
--limit 50
# GitHub Actions logs
gh run view <run-id> --log# View secret access logs
gcloud logging read "resource.type=\"secretmanager.googleapis.com/Secret\" \
AND protoPayload.methodName=\"google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion\"" \
--project diagnostic-pro-prod \
--limit 50# Add new version of secret
echo "NEW_SECRET_VALUE" | gcloud secrets versions add SECRET_NAME \
--project=diagnostic-pro-prod \
--data-file=-
# Next deployment will automatically use latest version# Create new service account
gcloud iam service-accounts create github-actions-deployer-v2 \
--project=diagnostic-pro-prod
# Update WIF binding
gcloud iam service-accounts add-iam-policy-binding \
github-actions-deployer-v2@diagnostic-pro-prod.iam.gserviceaccount.com \
--role="roles/iam.workloadIdentityUser" \
--member="principalSet://iam.googleapis.com/projects/298932670545/locations/global/workloadIdentityPools/github-actions-pool/attribute.repository/jeremylongshore/DiagnosticPro"
# Update workflow file with new service account# Disable workflow via GitHub UI
# Or add condition to workflow:
if: false # Temporarily disable workflow- Security Setup Guide - Complete security architecture
- Security Quick Reference - Quick commands
- Main README - Project overview
- CLAUDE.md - Development guidelines
Issue: Error: google-github-actions/auth failed
Solution:
- Verify WIF configuration:
gcloud iam workload-identity-pools describe github-actions-pool \ --project=diagnostic-pro-prod \ --location=global
- Check service account permissions
- Verify repository owner matches condition (
jeremylongshore)
Issue: Failed to access secret: NOT_FOUND
Solution:
- Verify secret exists:
gcloud secrets list --project=diagnostic-pro-prod
- Check service account has
secretmanager.secretAccessorrole - Ensure secret name matches in deployment command
Issue: Deployment takes > 10 minutes
Solution:
- Check Cloud Build logs
- Verify source directory path is correct
- Ensure
package.jsonexists in source directory - Check for large files in source (use
.gcloudignore)
- Never commit secrets - Use Secret Manager
- Test locally first - Run CI checks before pushing
- Use WIF - Avoid service account keys
- Monitor deployments - Check logs after each deploy
- Keep workflows simple - One responsibility per workflow
- Version your workflows - Use tagged actions (
@v4) - Document changes - Update this README when adding workflows
- GCP Console: https://console.cloud.google.com/run?project=diagnostic-pro-prod
- GitHub Actions: https://github.com/jeremylongshore/DiagnosticPro/actions
- Secret Manager: https://console.cloud.google.com/security/secret-manager?project=diagnostic-pro-prod
Last Updated: 2025-11-20 Maintained By: Jeremy Longshore Project: DiagnosticPro (diagnostic-pro-prod)