From 350d660936fcc27dc90c2214902cfad78c5dc434 Mon Sep 17 00:00:00 2001 From: Jared Schoeny Date: Tue, 7 Jul 2026 12:29:16 -0600 Subject: [PATCH] Add supabase db migration workflows (#65) * Add ci supabase workflows * Fix unused db seeding --- .github/workflows/ci.yaml | 30 ++++++++++++++++++++++++ .github/workflows/deploy_migrations.yaml | 27 +++++++++++++++++++++ supabase/config.toml | 2 +- 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/deploy_migrations.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..d6fadcb --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,30 @@ +name: CI + +on: + pull_request: + paths: + - 'supabase/**' + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: supabase/setup-cli@v1 + with: + version: latest + + - name: Start Supabase local development setup + run: supabase db start + + - name: Verify generated types are checked in + run: | + supabase gen types typescript --local > src/types/db.ts + if ! git diff --ignore-space-at-eol --exit-code --quiet src/types/db.ts; then + echo "Detected uncommitted changes in src/types/db.ts after build. See status below:" + git diff + exit 1 + fi diff --git a/.github/workflows/deploy_migrations.yaml b/.github/workflows/deploy_migrations.yaml new file mode 100644 index 0000000..3187e14 --- /dev/null +++ b/.github/workflows/deploy_migrations.yaml @@ -0,0 +1,27 @@ +name: Deploy Supabase Migrations to Production + +on: + push: + branches: [main] + paths: + - 'supabase/migrations/**' + - 'supabase/config.toml' + workflow_dispatch: + +jobs: + migrate: + runs-on: ubuntu-latest + + env: + SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} + SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }} + SUPABASE_PROJECT_ID: ${{ secrets.SUPABASE_PROJECT_ID }} + + steps: + - uses: actions/checkout@v4 + - uses: supabase/setup-cli@v1 + with: + version: latest + + - run: supabase link --project-ref $SUPABASE_PROJECT_ID + - run: supabase db push diff --git a/supabase/config.toml b/supabase/config.toml index dd12aba..8f8d99d 100644 --- a/supabase/config.toml +++ b/supabase/config.toml @@ -57,7 +57,7 @@ schema_paths = [] [db.seed] # If enabled, seeds the database after migrations during a db reset. -enabled = true +enabled = false # Specifies an ordered list of seed files to load during db reset. # Supports glob patterns relative to supabase directory: "./seeds/*.sql" sql_paths = ["./seed.sql"]