File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Vercel Optimization Deployment
2+ env :
3+ VERCEL_ORG_ID : ${{ secrets.VERCEL_ORG_ID }}
4+ VERCEL_PROJECT_ID : ${{ secrets.VERCEL_PROJECT_ID }}
5+ on :
6+ push :
7+ branches :
8+ - main
9+ pull_request : # 关键:任何人的 PR 都会触发,且不再需要手动授权
10+ jobs :
11+ deploy :
12+ runs-on : ubuntu-latest
13+ steps :
14+ - uses : actions/checkout@v4
15+
16+ - name : Install pnpm
17+ uses : pnpm/action-setup@v4
18+ with :
19+ version : 10.32.0 # 对应你 package.json 里的 pnpm 版本
20+
21+ - name : Install Node.js
22+ uses : actions/setup-node@v4
23+ with :
24+ node-version : 20
25+ cache : ' pnpm'
26+ cache-dependency-path : WWW/pnpm-lock.yaml
27+
28+ - name : Install Vercel CLI
29+ run : npm install --global vercel@latest
30+
31+ - name : Pull Vercel Environment Information
32+ run : vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
33+
34+ - name : Build Project Artifacts
35+ run : vercel build --token=${{ secrets.VERCEL_TOKEN }}
36+
37+ - name : Deploy Project Artifacts to Vercel
38+ run : vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} > deployment_url.txt
39+
40+ # 可选:如果你想让机器人在 PR 下面自动留言预览链接
41+ - name : Output Deployment URL
42+ if : github.event_name == 'pull_request'
43+ run : |
44+ echo "预览地址已生成: $(cat deployment_url.txt)"
You can’t perform that action at this time.
0 commit comments