From f3ea92103bc2e47826a5998db1928d53a3791061 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 18 May 2025 22:38:39 +0000 Subject: [PATCH 1/3] Add GitHub Actions workflows for Supabase staging and production environments Co-Authored-By: kiet@onlook.dev --- .github/workflows/supabase-ci.yml | 29 +++++++++++++++++++++++ .github/workflows/supabase-production.yml | 25 +++++++++++++++++++ .github/workflows/supabase-staging.yml | 25 +++++++++++++++++++ README.md | 14 +++++++++++ 4 files changed, 93 insertions(+) create mode 100644 .github/workflows/supabase-ci.yml create mode 100644 .github/workflows/supabase-production.yml create mode 100644 .github/workflows/supabase-staging.yml diff --git a/.github/workflows/supabase-ci.yml b/.github/workflows/supabase-ci.yml new file mode 100644 index 0000000000..0974bb41bb --- /dev/null +++ b/.github/workflows/supabase-ci.yml @@ -0,0 +1,29 @@ +name: Validate Supabase Migrations + +on: + pull_request: + branches: + - develop + - main + workflow_dispatch: + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: supabase/setup-cli@v1 + with: + version: latest + + - name: Start Supabase local development environment + run: supabase start + + - name: Validate migrations + run: | + # Check if migrations can be applied without errors + supabase db reset + + # Additional validation can be added here + echo "Migrations validated successfully" diff --git a/.github/workflows/supabase-production.yml b/.github/workflows/supabase-production.yml new file mode 100644 index 0000000000..13ffa73f8e --- /dev/null +++ b/.github/workflows/supabase-production.yml @@ -0,0 +1,25 @@ +name: Deploy Supabase 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@v4 + + - uses: supabase/setup-cli@v1 + with: + version: latest + + - run: supabase link --project-ref $SUPABASE_PROJECT_ID + + - run: supabase db push diff --git a/.github/workflows/supabase-staging.yml b/.github/workflows/supabase-staging.yml new file mode 100644 index 0000000000..5d181c3d4e --- /dev/null +++ b/.github/workflows/supabase-staging.yml @@ -0,0 +1,25 @@ +name: Deploy Supabase to Staging + +on: + push: + branches: + - develop + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + env: + SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} + SUPABASE_DB_PASSWORD: ${{ secrets.STAGING_DB_PASSWORD }} + SUPABASE_PROJECT_ID: ${{ secrets.STAGING_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/README.md b/README.md index 8c3f81811c..42b93d0559 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,20 @@ Projects we're inspired by: - [Supabase](https://github.com/supabase/supabase) +## CI/CD for Supabase + +Supabase environments are deployed automatically using GitHub Actions: + +- **Staging**: Changes to the `develop` branch are automatically deployed to the staging Supabase project +- **Production**: Changes to the `main` branch are automatically deployed to the production Supabase project + +Required GitHub Secrets: +- `SUPABASE_ACCESS_TOKEN` - Personal access token from Supabase +- `STAGING_DB_PASSWORD` - Database password for staging environment +- `STAGING_PROJECT_ID` - Project ID for staging environment +- `PRODUCTION_DB_PASSWORD` - Database password for production environment +- `PRODUCTION_PROJECT_ID` - Project ID for production environment + ## License Distributed under the Apache 2.0 License. See [LICENSE.md](LICENSE.md) for more From aff144da275e8b5a1266dca9e59e7f23d289b2bc Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Mon, 19 May 2025 15:15:50 +0000 Subject: [PATCH 2/3] Update environment variable names to be more specific Co-Authored-By: kiet@onlook.dev --- .github/workflows/supabase-production.yml | 2 +- .github/workflows/supabase-staging.yml | 2 +- README.md | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/supabase-production.yml b/.github/workflows/supabase-production.yml index 13ffa73f8e..204fa3e5c5 100644 --- a/.github/workflows/supabase-production.yml +++ b/.github/workflows/supabase-production.yml @@ -12,7 +12,7 @@ jobs: env: SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} SUPABASE_DB_PASSWORD: ${{ secrets.PRODUCTION_DB_PASSWORD }} - SUPABASE_PROJECT_ID: ${{ secrets.PRODUCTION_PROJECT_ID }} + SUPABASE_PROJECT_ID: ${{ secrets.SUPABASE_PRODUCTION_PROJECT_ID }} steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/supabase-staging.yml b/.github/workflows/supabase-staging.yml index 5d181c3d4e..f42b7af309 100644 --- a/.github/workflows/supabase-staging.yml +++ b/.github/workflows/supabase-staging.yml @@ -12,7 +12,7 @@ jobs: env: SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} SUPABASE_DB_PASSWORD: ${{ secrets.STAGING_DB_PASSWORD }} - SUPABASE_PROJECT_ID: ${{ secrets.STAGING_PROJECT_ID }} + SUPABASE_PROJECT_ID: ${{ secrets.SUPABASE_STAGING_PROJECT_ID }} steps: - uses: actions/checkout@v4 diff --git a/README.md b/README.md index 42b93d0559..7b0426590b 100644 --- a/README.md +++ b/README.md @@ -128,9 +128,9 @@ Supabase environments are deployed automatically using GitHub Actions: Required GitHub Secrets: - `SUPABASE_ACCESS_TOKEN` - Personal access token from Supabase - `STAGING_DB_PASSWORD` - Database password for staging environment -- `STAGING_PROJECT_ID` - Project ID for staging environment +- `SUPABASE_STAGING_PROJECT_ID` - Project ID for staging environment - `PRODUCTION_DB_PASSWORD` - Database password for production environment -- `PRODUCTION_PROJECT_ID` - Project ID for production environment +- `SUPABASE_PRODUCTION_PROJECT_ID` - Project ID for production environment ## License From 01aae9117b3f34dd8a218771fa9bccf9a1471e8a Mon Sep 17 00:00:00 2001 From: Kiet Ho Date: Tue, 20 May 2025 13:31:14 -0700 Subject: [PATCH 3/3] update readme --- README.md | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/README.md b/README.md index 7b0426590b..8c3f81811c 100644 --- a/README.md +++ b/README.md @@ -118,20 +118,6 @@ Projects we're inspired by: - [Supabase](https://github.com/supabase/supabase) -## CI/CD for Supabase - -Supabase environments are deployed automatically using GitHub Actions: - -- **Staging**: Changes to the `develop` branch are automatically deployed to the staging Supabase project -- **Production**: Changes to the `main` branch are automatically deployed to the production Supabase project - -Required GitHub Secrets: -- `SUPABASE_ACCESS_TOKEN` - Personal access token from Supabase -- `STAGING_DB_PASSWORD` - Database password for staging environment -- `SUPABASE_STAGING_PROJECT_ID` - Project ID for staging environment -- `PRODUCTION_DB_PASSWORD` - Database password for production environment -- `SUPABASE_PRODUCTION_PROJECT_ID` - Project ID for production environment - ## License Distributed under the Apache 2.0 License. See [LICENSE.md](LICENSE.md) for more