Skip to content

Commit 4470c3a

Browse files
committed
feat: add vercel-deploy gha
1 parent f4808fc commit 4470c3a

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

.github/workflows/prerelease.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Vercel Preview Deployment
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- main
7+
8+
jobs:
9+
deploy-en:
10+
uses: ./.github/workflows/vercel-deploy.yml
11+
with:
12+
environment: preview
13+
prodFlag: ''
14+
secrets:
15+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_EN_ID }}
16+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
17+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
18+
19+
deploy-zh-hans:
20+
uses: ./.github/workflows/vercel-deploy.yml
21+
with:
22+
environment: preview
23+
prodFlag: ''
24+
secrets:
25+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ZH_HANS_ID }}
26+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
27+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Vercel Deploy
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
environment:
7+
description: 'Vercel environment (production or preview)'
8+
required: true
9+
type: string
10+
prodFlag:
11+
description: 'Set to --prod for production deploys, empty for preview'
12+
required: false
13+
type: string
14+
default: ''
15+
secrets:
16+
VERCEL_PROJECT_ID:
17+
required: true
18+
VERCEL_ORG_ID:
19+
required: true
20+
VERCEL_TOKEN:
21+
required: true
22+
23+
jobs:
24+
deploy:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v3
29+
with:
30+
fetch-depth: 1
31+
32+
- name: Install Vercel CLI
33+
run: npm install --global vercel
34+
35+
- name: Pull Vercel Environment Information
36+
run: vercel pull --yes --environment=${{ inputs.environment }} --token=${{ secrets.VERCEL_TOKEN }}
37+
env:
38+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
39+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
40+
41+
- name: Build Project Artifacts
42+
run: vercel build ${{ inputs.prodFlag }} --token=${{ secrets.VERCEL_TOKEN }}
43+
env:
44+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
45+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
46+
47+
- name: Deploy Project Artifacts
48+
run: vercel deploy --prebuilt ${{ inputs.prodFlag }} --token=${{ secrets.VERCEL_TOKEN }}
49+
env:
50+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
51+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}

0 commit comments

Comments
 (0)