Skip to content

Commit 35e4cf5

Browse files
authored
Merge pull request #1 from parameshjava/deploy-split
Split deployment pipeline per action
2 parents 28fec08 + 88f75e2 commit 35e4cf5

2 files changed

Lines changed: 63 additions & 35 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
1-
name: CI & Deploy to Vercel
1+
name: PR — CI + Vercel Preview
22

33
on:
4-
push:
5-
branches: [main]
64
pull_request:
75
branches: [main]
86

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

1412
env:
1513
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
1614
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
1715

1816
jobs:
19-
# Fast feedback: fails the PR before we burn time on a Vercel build.
2017
ci:
2118
name: Lint + Type-check
2219
runs-on: ubuntu-latest
@@ -38,10 +35,8 @@ jobs:
3835
- name: Type check
3936
run: npx tsc --noEmit
4037

41-
# Preview deploy on pull requests.
4238
deploy-preview:
4339
name: Vercel Preview Deploy
44-
if: github.event_name == 'pull_request'
4540
needs: ci
4641
runs-on: ubuntu-latest
4742
steps:
@@ -64,30 +59,3 @@ jobs:
6459

6560
- name: Deploy preview
6661
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 }}

.github/workflows/production.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Main — CI + Vercel Production
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
concurrency:
8+
group: production-${{ github.ref }}
9+
cancel-in-progress: false
10+
11+
env:
12+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
13+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
14+
15+
jobs:
16+
ci:
17+
name: Lint + Type-check
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: 22
26+
cache: npm
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
31+
- name: Lint
32+
run: npm run lint
33+
34+
- name: Type check
35+
run: npx tsc --noEmit
36+
37+
deploy-production:
38+
name: Vercel Production Deploy
39+
needs: ci
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v4
43+
44+
- name: Setup Node.js
45+
uses: actions/setup-node@v4
46+
with:
47+
node-version: 22
48+
cache: npm
49+
50+
- name: Install Vercel CLI
51+
run: npm install --global vercel@latest
52+
53+
- name: Pull Vercel environment (production)
54+
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
55+
56+
- name: Build (production)
57+
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
58+
59+
- name: Deploy to production
60+
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}

0 commit comments

Comments
 (0)