Skip to content

Commit

Permalink
chore(Root): create supabase-update-db.yml and rename ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
dartilesm committed Sep 14, 2024
1 parent ae32515 commit ab862cb
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 63 deletions.
63 changes: 0 additions & 63 deletions .github/workflows/ci.yml

This file was deleted.

63 changes: 63 additions & 0 deletions .github/workflows/supabase-tests-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Supabase checks

on:
pull_request:
push:
paths:
- "apps/chat-with-pdf/**"
branches:
- "feature/**"
workflow_dispatch:

jobs:
test:
name: Supabase tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

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

- name: Init Supabase local development setup
run: supabase init

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

- name: Run Supabase lint locally
run: supabase db lint

- name: Run Supabase tests locally
run: supabase test db

- name: Verify generated types are checked in
run: |
supabase gen types typescript --local > apps/chat-with-pdf/database.types.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
push:
name: Push to Supabase
runs-on: ubuntu-latest
env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_PROJECT_ID: ${{ secrets.SUPABASE_STAGING_PROJECT_ID }}
SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_STAGING_DB_PASSWORD }}
SUPABASE_AUTH_GITHUB_CLIENT_ID: ${{ secrets.SUPABASE_AUTH_GITHUB_CLIENT_ID }}
SUPABASE_AUTH_GITHUB_SECRET: ${{ secrets.SUPABASE_AUTH_GITHUB_SECRET }}

steps:
- uses: actions/checkout@v4
- uses: supabase/setup-cli@v1
with:
version: latest

- run: supabase link --project-ref $SUPABASE_PROJECT_ID --debug
working-directory: apps/chat-with-pdf
- run: supabase db push --dry-run
working-directory: apps/chat-with-pdf
32 changes: 32 additions & 0 deletions .github/workflows/supabase-update-db.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Supabase update

on:
push:
paths:
- "apps/chat-with-pdf/**"
branches:
- "develop"
- "main"
workflow_dispatch:

jobs:
update:
name: Update Supabase db
runs-on: ubuntu-latest
env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_PROJECT_ID: ${{ github.base_ref == 'main' && secrets.SUPABASE_PROD_PROJECT_ID || secrets.SUPABASE_STAGING_PROJECT_ID }}
SUPABASE_DB_PASSWORD: ${{ github.base_ref == 'main' && secrets.SUPABASE_PROD_DB_PASSWORD || secrets.SUPABASE_STAGING_DB_PASSWORD }}
SUPABASE_AUTH_GITHUB_CLIENT_ID: ${{ secrets.SUPABASE_AUTH_GITHUB_CLIENT_ID }}
SUPABASE_AUTH_GITHUB_SECRET: ${{ secrets.SUPABASE_AUTH_GITHUB_SECRET }}

steps:
- uses: actions/checkout@v4
- uses: supabase/setup-cli@v1
with:
version: latest

- run: supabase link --project-ref $SUPABASE_PROJECT_ID --debug
working-directory: apps/chat-with-pdf
- run: supabase db push
working-directory: apps/chat-with-pdf

0 comments on commit ab862cb

Please sign in to comment.