Skip to content

ci: deploy db migrations and edge functions in one workflow#32

Merged
chiptus merged 13 commits into
mainfrom
claude/debug-edge-function-staging-XYcg6
May 16, 2026
Merged

ci: deploy db migrations and edge functions in one workflow#32
chiptus merged 13 commits into
mainfrom
claude/debug-edge-function-staging-XYcg6

Conversation

@chiptus
Copy link
Copy Markdown
Owner

@chiptus chiptus commented May 16, 2026

Splits the old db-migrate workflow into two reusable sub-workflows orchestrated by deploy.yml, so PRs deploy migrations and edge functions to staging (and pushes to main to prod) in one place.


Generated by Claude Code

Splits db-migrate into two reusable sub-workflows (_db_migrate,
_deploy_edge_functions) orchestrated by deploy.yml. PRs deploy to
staging; pushes to main deploy to prod. paths-filter skips jobs when
the relevant files weren't touched.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
upline Ready Ready Preview, Comment May 16, 2026 4:58pm

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Replaces the standalone db-migrate.yml workflow with a single orchestrator (deploy.yml) that calls two reusable sub-workflows (_db_migrate.yml and _deploy_edge_functions.yml), so a single workflow run handles both DB migrations and edge function deploys (staging for PRs, prod for pushes to main).

Changes:

  • Adds deploy.yml orchestrator that resolves the target environment, uses dorny/paths-filter to detect which sub-workflows to run, and posts/updates a combined PR status comment.
  • Adds reusable workflows _db_migrate.yml and _deploy_edge_functions.yml, each taking a target input and selecting the corresponding project ref/secrets.
  • Removes the legacy db-migrate.yml workflow.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
.github/workflows/deploy.yml New orchestrator: resolves target, runs path-filter, calls sub-workflows, posts combined PR comment.
.github/workflows/_db_migrate.yml New reusable workflow that links Supabase and pushes migrations for the given target.
.github/workflows/_deploy_edge_functions.yml New reusable workflow that deploys Supabase edge functions for the given target.
.github/workflows/db-migrate.yml Removed; functionality folded into the orchestrator + reusable migrate workflow.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 16, 2026

Deploy → stagingworkflow run
Last updated: 2026-05-16 16:58:01 UTC

  • ⏭️ DB migrations skipped (no changes)
  • ⏭️ Edge functions skipped (no changes)

Comment thread .github/workflows/_deploy_edge_functions.yml
Comment thread .github/workflows/_deploy_edge_functions.yml
Comment thread .github/workflows/deploy.yml Outdated
- Validate target input in reusable workflows (workflow_call doesn't
  support type: choice)
- Drop pinned supabase-cli version, let setup-cli auto-resolve from
  package.json
- Extract PR comment logic to .github/scripts/post-deploy-comment.sh
setup-cli auto-detect resolved to v2.20.3 in CI despite package.json
declaring ^2.58.5, so the auto-resolution is unreliable. Re-pinning
to 2.58.5 explicitly.
Each PR run wipes the staging DB and reapplies all migrations from
source. Avoids drift when parallel PRs add different migrations to a
shared staging environment.

Three layers ensure prod can never hit this path:
- step gated on inputs.target == 'staging'
- guard that aborts if STAGING_PROJECT_REF == PROD_PROJECT_REF
- reset step only references STAGING_* vars/secrets
Reverts the auto-reset on staging. Instead, when the migrate job fails
on a PR, the status comment now includes instructions for manually
resetting and re-seeding staging via supabase db reset + db:sync:staging.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread .github/workflows/deploy.yml
Comment thread .github/workflows/deploy.yml Outdated
Comment thread .github/workflows/_db_migrate.yml Outdated
- environment: only resolves to 'production' or 'staging' for valid
  inputs; invalid values yield empty string and fail the job before
  any step runs (no accidental secret exposure)
- comment job now requires needs.resolve.result == 'success' so it
  doesn't run with empty TARGET when target resolution fails
@chiptus chiptus merged commit 7f4dbf5 into main May 16, 2026
13 checks passed
@chiptus chiptus deleted the claude/debug-edge-function-staging-XYcg6 branch May 22, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants