Skip to content

Vercel Deployment

Vercel Deployment #52

Workflow file for this run

name: Vercel Deployment
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
on:
push:
branches:
- 'main'
paths-ignore:
- '**/*.md'
workflow_dispatch:
branches: [main]
jobs:
paths-filter:
runs-on: ubuntu-latest
outputs:
should_sync_db: ${{ steps.filter.outputs.prisma }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
prisma:
- 'prisma/**'
Sync-Database:
runs-on: ubuntu-latest
needs: [paths-filter]
if: needs.Paths-filter.outputs.prisma == 'true'
steps:
- uses: actions/checkout@v3
- name: Install PNPM
run: npm install --global pnpm
- name: Install Dependencies
run: pnpm install
- name: Create prisma client
run: pnpm exec prisma generate
- name: Sync database with schema
run: pnpm exec prisma migrate deploy
Deploy-App:
runs-on: ubuntu-latest
needs: [Sync-Database]
if: |
always() &&
(needs.Sync-database.result == 'success' || needs.Sync-database.result == 'skipped')
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 6.35.1
- name: Install Vercel Build Utils
run: pnpm add -g @vercel/build-utils
- name: Install Vercel CLI
run: pnpm add -g vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
- name: Promote deployment
run: vercel --prod --token=${{ secrets.VERCEL_TOKEN }}