-
Notifications
You must be signed in to change notification settings - Fork 43
44 lines (37 loc) · 1.37 KB
/
Copy pathdocs-deploy.yml
File metadata and controls
44 lines (37 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: Deploy Docs
# 文档站只在打 tag 时部署,避免 main 上尚未随版本发布的文档被公开。
# Vercel 的 Git 自动部署已在 docs-site/vercel.json 用 git.deploymentEnabled=false 关闭,
# 生产部署统一由本工作流用 Vercel CLI 完成。
# 前置配置(GitHub 仓库 Secret):VERCEL_TOKEN、VERCEL_ORG_ID、VERCEL_PROJECT_ID
on:
push:
tags:
- 'v*'
jobs:
deploy:
name: Deploy Docs to Vercel
runs-on: ubuntu-latest
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
# vercel.json / package-lock.json 都在 docs-site,项目根即此处。
defaults:
run:
working-directory: docs-site
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node 20
uses: actions/setup-node@v4
with:
node-version: '20'
cache: npm
cache-dependency-path: docs-site/package-lock.json
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel environment
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}