From 676c54cdfaf47e7068fe637e7b7aa203580b17b8 Mon Sep 17 00:00:00 2001 From: thiru Date: Sun, 26 Jul 2026 00:42:21 +0530 Subject: [PATCH] =?UTF-8?q?Add=20Supabase=20migration=20CI=20job=20?= =?UTF-8?q?=E2=80=94=20auto-runs=20on=20main=20push,=20setup-cli,=20db=20p?= =?UTF-8?q?ush?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 3 +++ .github/workflows/deploy.yml | 21 ++++++++++++++++++--- package.json | 4 +++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index ebaf0c5..40779c8 100644 --- a/.env.example +++ b/.env.example @@ -2,6 +2,9 @@ SUPABASE_URL=https://your-project.supabase.co SUPABASE_ANON_KEY=your-anon-key SUPABASE_SERVICE_ROLE_KEY=your-service-role-key +SUPABASE_ACCESS_TOKEN=your-supabase-access-token +SUPABASE_PROJECT_REF=your-project-ref +SUPABASE_DB_PASSWORD=your-db-password # Google Gemini (Vision + LLM + Embeddings) GEMINI_API_KEY=your-gemini-api-key diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4f1e2c2..b186c58 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -2,7 +2,7 @@ name: Deploy CircuLink on: push: - branches: [main, master] + branches: [main, master, roshan] jobs: typecheck: @@ -14,8 +14,23 @@ jobs: - run: npm ci - run: npx tsc --noEmit - # NitroCloud auto-deploys on push when connected. - # Connect: https://cloud.nitrostack.ai → Import GitHub repo → Auto-deploy on push + migrate: + needs: typecheck + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + steps: + - uses: actions/checkout@v4 + - uses: supabase/setup-cli@v1 + with: + version: latest + - run: supabase link --project-ref $SUPABASE_PROJECT_REF + env: + SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} + SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }} + - run: supabase db push + env: + SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} + SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }} docker: needs: typecheck diff --git a/package.json b/package.json index 0ac4f43..1749536 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,9 @@ "nitrostack:start": "nitrostack-cli build && node dist/main.js", "widgets:dev": "cd widgets && next dev -p 3001", "widgets:build": "cd widgets && next build", - "db:migrate": "supabase db push", + "postinstall": "nitrostack-cli install", + "db:migrate": "npx supabase db push", + "db:migrate:ci": "npx supabase db push --password $SUPABASE_DB_PASSWORD", "db:seed": "supabase db seed run", "lint": "eslint src/**/*.ts", "typecheck": "tsc --noEmit"