supabase db push, functions deploy and link in CI
supabase link connects the repo to a project, supabase db push applies local migrations to the remote database, and supabase functions deploy ships Edge Functions.
The Supabase CLI manages migrations and functions. In CI you authenticate with an access token, link by project ref, and push.
What it does
supabase link --project-ref ties the working directory to a project. supabase db push applies the SQL files in supabase/migrations to the linked remote database. supabase functions deploy NAME bundles and deploys an Edge Function (Deno) to the project.
Common usage
# token auth, then link by project ref
export SUPABASE_ACCESS_TOKEN=sbp_xxx
supabase link --project-ref abcdwxyz
supabase db push
supabase functions deploy hello --no-verify-jwtOptions
| Command / flag | What it does |
|---|---|
| link --project-ref <ref> | Link the directory to a project |
| db push | Apply local migrations to the remote DB |
| db push --dry-run | Show what would be applied without running it |
| functions deploy <name> | Deploy an Edge Function |
| --no-verify-jwt | Deploy a function without JWT verification |
| SUPABASE_ACCESS_TOKEN | Personal access token for CI auth |
In CI
Set SUPABASE_ACCESS_TOKEN so the CLI does not prompt for login. supabase db push needs the database password; pass it via SUPABASE_DB_PASSWORD or the -p flag so it does not prompt. Run db push --dry-run in PRs to preview migrations before merging.
Common errors in CI
"Access token not provided. Supply an access token by running supabase login" means SUPABASE_ACCESS_TOKEN is unset. "Cannot find project ref. Have you run supabase link?" means link did not run or the ref is wrong. A db push that prompts for a password needs SUPABASE_DB_PASSWORD set.