-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added github ci/cd for supabase db migration
- Loading branch information
1 parent
f9f3470
commit 3ee06b2
Showing
3 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: supabase/setup-cli@v1 | ||
|
||
- name: Start Supabase local development setup | ||
run: supabase start | ||
|
||
- name: Verify generated types are up-to-date | ||
run: | | ||
supabase gen types typescript --local > types.ts | ||
if [ "$(git diff --ignore-space-at-eol types.ts | wc -l)" -gt "0" ]; then | ||
echo "Detected uncommitted changes after build. See status below:" | ||
git diff | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Deploy Migrations to Production | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-22.04 | ||
|
||
env: | ||
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} | ||
SUPABASE_DB_PASSWORD: ${{ secrets.PRODUCTION_DB_PASSWORD }} | ||
PRODUCTION_PROJECT_ID: abcdefghijklmnopqrst | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: supabase/setup-cli@v1 | ||
|
||
- run: | | ||
supabase link --project-ref $PRODUCTION_PROJECT_ID | ||
supabase db push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Deploy Migrations to Staging | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-22.04 | ||
|
||
env: | ||
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} | ||
SUPABASE_DB_PASSWORD: ${{ secrets.STAGING_DB_PASSWORD }} | ||
STAGING_PROJECT_ID: abcdefghijklmnopqrst | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: supabase/setup-cli@v1 | ||
|
||
- run: | | ||
supabase link --project-ref $STAGING_PROJECT_ID | ||
supabase db push |