Skip to content

Commit 7796e3d

Browse files
committed
add vercel workflow
1 parent 1853946 commit 7796e3d

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

.github/workflows/vercel.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Deploy to Vercel
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
8+
env:
9+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
10+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
11+
12+
jobs:
13+
deploy:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Node
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 20
23+
24+
- name: Install Vercel CLI
25+
run: npm i -g vercel
26+
27+
- name: Pull Vercel Environment Information (production)
28+
if: github.ref == 'refs/heads/main'
29+
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
30+
31+
- name: Build (production)
32+
if: github.ref == 'refs/heads/main'
33+
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
34+
35+
- name: Deploy (production)
36+
if: github.ref == 'refs/heads/main'
37+
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
38+
39+
- name: Pull Vercel Environment Information (preview)
40+
if: github.ref != 'refs/heads/main'
41+
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
42+
43+
- name: Build (preview)
44+
if: github.ref != 'refs/heads/main'
45+
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
46+
47+
- name: Deploy (preview)
48+
if: github.ref != 'refs/heads/main'
49+
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}

0 commit comments

Comments
 (0)