|
1 | | -name: CI & Deploy to Vercel |
| 1 | +name: PR — CI + Vercel Preview |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: [main] |
6 | 4 | pull_request: |
7 | 5 | branches: [main] |
8 | 6 |
|
9 | | -# Cancel older in-flight runs on the same ref to avoid pile-ups. |
| 7 | +# Cancel older in-flight runs on the same PR. |
10 | 8 | concurrency: |
11 | | - group: ${{ github.workflow }}-${{ github.ref }} |
| 9 | + group: preview-${{ github.ref }} |
12 | 10 | cancel-in-progress: true |
13 | 11 |
|
14 | 12 | env: |
15 | 13 | VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} |
16 | 14 | VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} |
17 | 15 |
|
18 | 16 | jobs: |
19 | | - # Fast feedback: fails the PR before we burn time on a Vercel build. |
20 | 17 | ci: |
21 | 18 | name: Lint + Type-check |
22 | 19 | runs-on: ubuntu-latest |
|
38 | 35 | - name: Type check |
39 | 36 | run: npx tsc --noEmit |
40 | 37 |
|
41 | | - # Preview deploy on pull requests. |
42 | 38 | deploy-preview: |
43 | 39 | name: Vercel Preview Deploy |
44 | | - if: github.event_name == 'pull_request' |
45 | 40 | needs: ci |
46 | 41 | runs-on: ubuntu-latest |
47 | 42 | steps: |
|
64 | 59 |
|
65 | 60 | - name: Deploy preview |
66 | 61 | run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} |
67 | | - |
68 | | - # Production deploy on push to main. |
69 | | - deploy-production: |
70 | | - name: Vercel Production Deploy |
71 | | - if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
72 | | - needs: ci |
73 | | - runs-on: ubuntu-latest |
74 | | - steps: |
75 | | - - uses: actions/checkout@v4 |
76 | | - |
77 | | - - name: Setup Node.js |
78 | | - uses: actions/setup-node@v4 |
79 | | - with: |
80 | | - node-version: 22 |
81 | | - cache: npm |
82 | | - |
83 | | - - name: Install Vercel CLI |
84 | | - run: npm install --global vercel@latest |
85 | | - |
86 | | - - name: Pull Vercel environment (production) |
87 | | - run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} |
88 | | - |
89 | | - - name: Build (production) |
90 | | - run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} |
91 | | - |
92 | | - - name: Deploy to production |
93 | | - run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} |
0 commit comments