This repository follows Supabase's recommended workflow for managing multiple environments (staging and production) using GitHub Actions.
- Triggers: On all pull requests and manual workflow dispatch
- Purpose: Run tests to validate changes before merging
- Jobs:
test: Runs the full test suite
- Triggers: On push to
developbranch and manual workflow dispatch - Purpose: Automatically deploy to staging environment for testing
- Jobs:
test: Runs tests before deploymentdeploy-staging: Deploys Edge Functions to staging Supabase project
- Environment: Uses GitHub environment
stagingwith URL tracking
- Triggers: On push to
mainbranch and manual workflow dispatch - Purpose: Deploy to production after changes are validated in staging
- Jobs:
test: Runs tests before deploymentdeploy-production: Deploys Edge Functions to production Supabase project
- Environment: Uses GitHub environment
productionwith URL tracking
feature/new-feature
↓ (PR)
develop (staging environment)
↓ (PR)
main (production environment)
-
Create a feature branch from
develop:git checkout develop git pull git checkout -b feature/your-feature-name
-
Make changes and test locally:
pnpm test -
Open a PR to
develop:- CI workflow runs tests
- Review and merge when tests pass
-
Automatic deployment to staging:
- Merging to
developtriggers the staging workflow - Edge Functions are deployed to staging Supabase project
- Test in staging environment
- Merging to
-
Promote to production:
- Open a PR from
developtomain - CI workflow runs tests again
- Review and merge when ready
- Open a PR from
-
Automatic deployment to production:
- Merging to
maintriggers the production workflow - Edge Functions are deployed to production Supabase project
- Merging to
You need to configure the following secrets in your GitHub repository settings:
BLOOM_SUPABASE_ACCESS_TOKEN: Your Supabase personal access token- Generate at: https://supabase.com/dashboard/account/tokens
BLOOM_SUPABASE_STAGING_PROJECT_ID: Staging project reference IDBLOOM_SUPABASE_PRODUCTION_PROJECT_ID: Production project reference ID- Find in project URL:
https://supabase.com/dashboard/project/<project-id>
- Find in project URL:
BLOOM_PARSE_APP_ID_PRODBLOOM_PARSE_APP_ID_DEVBLOOM_PARSE_APP_ID_UNIT_TEST
GitHub Environments provide additional protection and visibility:
- Go to Settings → Environments in your GitHub repository
- Create two environments:
stagingandproduction - For production, add protection rules:
- ✅ Required reviewers (add team members who must approve)
- ✅ Wait timer (optional delay before deployment)
⚠️ Deployment branches: Onlymainbranch
This adds manual approval gates for production deployments while keeping staging automatic.
The workflows don't affect local development. Continue using:
# Start local Supabase
supabase start
# Run tests locally
pnpm test
# Deploy functions locally
pnpm dev:functionsAll deployments happen automatically through GitHub Actions, but you can also deploy manually:
# Deploy to staging
supabase functions deploy --project-ref <BLOOM_SUPABASE_STAGING_PROJECT_ID>
# Deploy to production
supabase functions deploy --project-ref <BLOOM_SUPABASE_PRODUCTION_PROJECT_ID>Make sure you have BLOOM_SUPABASE_ACCESS_TOKEN set in your environment.
✅ Separation of Environments: Staging and production are completely isolated ✅ Automatic Testing: Every deployment is preceded by tests ✅ Safe Releases: Test in staging before promoting to production ✅ Audit Trail: GitHub Actions logs show all deployments ✅ Rollback Capability: Easy to revert by reverting the git commit ✅ Manual Overrides: Can manually trigger workflows when needed ✅ Protection Gates: Optional approval requirements for production
- This is a lint warning because secrets aren't defined yet
- Add the required secrets in GitHub repository settings
- The workflows will work once secrets are configured
- The warnings are expected until you create the environments in GitHub
- They're optional but recommended for production protection
- Workflows will work without environments, but won't have URL tracking
- Workflows only deploy on push to
developormain - PRs only run tests, not deployments
- Use
workflow_dispatchto manually trigger specific workflows