Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new workflow for supabase db migrations #17

Merged
merged 1 commit into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI

on:
pull_request:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: supabase/setup-cli@v1
with:
version: latest

- name: Start Supabase local development setup
run: supabase start

- name: Verify generated types are checked in
run: |
supabase gen types typescript --local > types.gen.ts
if ! git diff --ignore-space-at-eol --exit-code --quiet types.gen.ts; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
21 changes: 0 additions & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,6 @@ on:
- main

jobs:
database-migration:
name: Database migration
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
env:
CONNECTION_STRING: ${{ secrets.CONNECTION_STRING }}
steps:
- name: Checkout app
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
run: npm install -g pnpm && pnpm -v && pnpm i

- name: Check migration status
run: pnpm m:status

- name: Run migration
run: pnpm m:up

deploy:
name: Deploy app
runs-on: ubuntu-latest
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Deploy Migrations to Production

on:
push:
branches:
- main
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest

env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_DB_PASSWORD: ${{ secrets.PRODUCTION_DB_PASSWORD }}
SUPABASE_PROJECT_ID: ${{ secrets.PRODUCTION_PROJECT_ID }}

steps:
- uses: actions/checkout@v3

- uses: supabase/setup-cli@v1
with:
version: latest

- run: supabase link --project-ref $SUPABASE_PROJECT_ID
- run: supabase db push
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"postgres": "^3.3.4",
"prettier": "~3.0.1",
"prettier-plugin-svelte": "^3.0.3",
"supabase": "1.85.0",
"svelte": "^4.1.2",
"svelte-check": "^3.4.3",
"svelte-preprocess": "^5.0.4",
Expand Down
141 changes: 141 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.