Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 3 additions & 35 deletions .github/workflows/deploy.yml → .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
name: CI & Deploy to Vercel
name: PR — CI + Vercel Preview

on:
push:
branches: [main]
pull_request:
branches: [main]

# Cancel older in-flight runs on the same ref to avoid pile-ups.
# Cancel older in-flight runs on the same PR.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: preview-${{ github.ref }}
cancel-in-progress: true

env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

jobs:
# Fast feedback: fails the PR before we burn time on a Vercel build.
ci:
name: Lint + Type-check
runs-on: ubuntu-latest
Expand All @@ -38,10 +35,8 @@ jobs:
- name: Type check
run: npx tsc --noEmit

# Preview deploy on pull requests.
deploy-preview:
name: Vercel Preview Deploy
if: github.event_name == 'pull_request'
needs: ci
runs-on: ubuntu-latest
steps:
Expand All @@ -64,30 +59,3 @@ jobs:

- name: Deploy preview
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}

# Production deploy on push to main.
deploy-production:
name: Vercel Production Deploy
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm

- name: Install Vercel CLI
run: npm install --global vercel@latest

- name: Pull Vercel environment (production)
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}

- name: Build (production)
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}

- name: Deploy to production
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
60 changes: 60 additions & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Main — CI + Vercel Production

on:
push:
branches: [main]

concurrency:
group: production-${{ github.ref }}
cancel-in-progress: false

env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

jobs:
ci:
name: Lint + Type-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm

- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

- name: Type check
run: npx tsc --noEmit

deploy-production:
name: Vercel Production Deploy
needs: ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm

- name: Install Vercel CLI
run: npm install --global vercel@latest

- name: Pull Vercel environment (production)
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}

- name: Build (production)
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}

- name: Deploy to production
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
Loading