Skip to content

Commit 5853c76

Browse files
committed
chore: add deploy script for Vercel until GitHub Actions are set up
1 parent 4c6c854 commit 5853c76

2 files changed

Lines changed: 77 additions & 0 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,5 @@ operations/fix_institution_id.py
174174
operations/list_tables.py
175175
operations/convert_institution_id_to_string.py
176176
operations/verify_institution_id.py
177+
.vercel
178+
.env.deploy

scripts/deploy.sh

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/usr/bin/env bash
2+
# deploy.sh — Deploy Bishop State dashboard to Vercel
3+
#
4+
# Usage:
5+
# ./scripts/deploy.sh # deploy frontend only
6+
# ./scripts/deploy.sh --with-data # re-run ML pipeline + readiness scores, then deploy
7+
#
8+
# Requirements:
9+
# - Vercel CLI installed and authenticated (vercel login)
10+
# - Python venv at venv/ with dependencies installed
11+
# - DB_PASSWORD set in environment or .env.deploy (see below)
12+
#
13+
# Credentials are read from environment variables. To avoid typing them each
14+
# time, create a .env.deploy file (already in .gitignore) with:
15+
# export DB_PASSWORD=your-password
16+
17+
set -euo pipefail
18+
19+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
20+
ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
21+
DASHBOARD="$ROOT/codebenders-dashboard"
22+
PYTHON="$ROOT/venv/bin/python"
23+
24+
# ── Database (pooler) ────────────────────────────────────────────────────────
25+
export DB_HOST="${DB_HOST:-aws-1-us-east-1.pooler.supabase.com}"
26+
export DB_PORT="${DB_PORT:-6543}"
27+
export DB_USER="${DB_USER:-postgres.sdigpinxgnbeijoqgxzp}"
28+
export DB_NAME="${DB_NAME:-postgres}"
29+
30+
# Load DB_PASSWORD from .env.deploy if not already set
31+
if [[ -z "${DB_PASSWORD:-}" && -f "$ROOT/.env.deploy" ]]; then
32+
# shellcheck source=/dev/null
33+
source "$ROOT/.env.deploy"
34+
fi
35+
36+
if [[ -z "${DB_PASSWORD:-}" ]]; then
37+
echo "Error: DB_PASSWORD is not set."
38+
echo "Either export it or add it to .env.deploy:"
39+
echo " echo 'export DB_PASSWORD=your-password' > .env.deploy"
40+
exit 1
41+
fi
42+
43+
# ── Flags ────────────────────────────────────────────────────────────────────
44+
WITH_DATA=false
45+
for arg in "$@"; do
46+
[[ "$arg" == "--with-data" ]] && WITH_DATA=true
47+
done
48+
49+
echo "================================================="
50+
echo " Bishop State — Deploy Script"
51+
echo " Mode: $([ "$WITH_DATA" = true ] && echo 'data + frontend' || echo 'frontend only')"
52+
echo "================================================="
53+
54+
# ── Data pipeline (optional) ─────────────────────────────────────────────────
55+
if [[ "$WITH_DATA" == true ]]; then
56+
echo ""
57+
echo "▶ Step 1/3 — ML pipeline"
58+
"$PYTHON" "$ROOT/ai_model/complete_ml_pipeline.py"
59+
60+
echo ""
61+
echo "▶ Step 2/3 — Readiness scores"
62+
"$PYTHON" "$ROOT/ai_model/generate_readiness_scores.py"
63+
else
64+
echo ""
65+
echo "▶ Skipping data pipeline (use --with-data to include)"
66+
fi
67+
68+
# ── Vercel deploy ─────────────────────────────────────────────────────────────
69+
echo ""
70+
echo "$([ "$WITH_DATA" = true ] && echo 'Step 3/3' || echo 'Step 1/1') — Vercel deploy"
71+
cd "$DASHBOARD"
72+
vercel --prod
73+
74+
echo ""
75+
echo "✓ Deploy complete."

0 commit comments

Comments
 (0)