Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gcloudignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file specifies files that are *not* uploaded to Google Cloud
# Only upload app.yaml and the built dist/ directory

# Exclude ALL source and config files
*
!app.yaml
!dist/
!dist/**
8 changes: 8 additions & 0 deletions .github/scripts/build-with-vite.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

echo "Starting build process with Vite..."
npm run build
echo "Build completed. Contents of dist/:"
ls -la dist/
echo "Verifying index.html exists:"
test -f dist/index.html && echo "✓ index.html found" || echo "✗ index.html missing"
File renamed without changes.
27 changes: 27 additions & 0 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test

on:
pull_request:
branches:
- '**'

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run tests (includes type checking)
run: npm test

64 changes: 64 additions & 0 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Deploy to App Engine

on:
push:
branches:
- master

permissions:
id-token: write
contents: read

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run tests (includes type checking)
run: npm test

deploy:
runs-on: ubuntu-latest
needs: test

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build application with Vite
run: .github/scripts/build-with-vite.sh

- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: "projects/83599293185/locations/global/workloadIdentityPools/prod-github-provider/providers/prod-github-provider"
service_account: "workflow-identity-provider@policyengine-app-v2.iam.gserviceaccount.com"

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
project_id: policyengine-app-v2

- name: Deploy to App Engine
run: gcloud app deploy --quiet --project policyengine-app-v2
39 changes: 39 additions & 0 deletions app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
runtime: nodejs20

env_variables:
GOOGLE_NODE_RUN_SCRIPTS: ""

handlers:
# Vite builds assets with hashed filenames in /assets/
- url: /assets
static_dir: dist/assets
secure: always
expiration: "365d"

# Common static files
- url: /favicon.ico
static_files: dist/favicon.ico
upload: dist/favicon.ico
secure: always

- url: /manifest.json
static_files: dist/manifest.json
upload: dist/manifest.json
secure: always

# Any other static files in dist root
- url: /(.+\.(js|css|png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot))$
static_files: dist/\1
upload: dist/(.+\.(js|css|png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot))$
secure: always
expiration: "365d"

# Handle React Router - serve index.html for all other routes
- url: /.*
static_files: dist/index.html
upload: dist/index.html
secure: always

automatic_scaling:
min_instances: 0
max_instances: 5
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"build": "vite build",
"build-with-types": "tsc --noEmit && vite build",
"preview": "vite preview",
"typecheck": "tsc --noEmit",
"lint": "npm run eslint && npm run stylelint",
Expand Down