mirror of
https://github.com/Hackdex-App/hackdex-website.git
synced 2026-08-22 00:24:34 -05:00
Add supabase db migration workflows (#65)
* Add ci supabase workflows * Fix unused db seeding
This commit is contained in:
30
.github/workflows/ci.yaml
vendored
Normal file
30
.github/workflows/ci.yaml
vendored
Normal file
@@ -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
|
||||
27
.github/workflows/deploy_migrations.yaml
vendored
Normal file
27
.github/workflows/deploy_migrations.yaml
vendored
Normal file
@@ -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
|
||||
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user