Created
August 1, 2025 12:50
-
-
Save felippewick/8aae7a455e6694ec1283d772f97ea6f4 to your computer and use it in GitHub Desktop.
Supabase migration and Vercel deployment github action
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
env: | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
on: | |
push: | |
branches: [staging, main] | |
pull_request: | |
branches: [staging] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
migrate: | |
runs-on: ubuntu-latest | |
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'staging' }} | |
defaults: | |
run: | |
working-directory: apps/web | |
env: | |
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} | |
SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }} | |
SUPABASE_PROJECT_REF: ${{ secrets.SUPABASE_PROJECT_REF }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: supabase/setup-cli@v1 | |
with: | |
version: latest | |
- run: npx supabase@latest link --project-ref $SUPABASE_PROJECT_REF | |
- run: npx supabase@latest db push | |
deploy: | |
runs-on: ubuntu-latest | |
needs: migrate | |
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'staging' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Install Vercel CLI | |
run: npm install --global vercel@latest | |
- name: Pull Vercel Environment Information | |
run: vercel pull --yes --environment=${{ github.ref == 'refs/heads/main' && 'production' || 'preview' }} --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Build Project Artifacts | |
run: vercel build ${{ github.ref == 'refs/heads/main' && '--prod' || '' }} --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Deploy Project Artifacts to Vercel | |
run: vercel deploy --prebuilt ${{ github.ref == 'refs/heads/main' && '--prod' || '' }} --token=${{ secrets.VERCEL_TOKEN }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment