File tree Expand file tree Collapse file tree 1 file changed +97
-0
lines changed
Expand file tree Collapse file tree 1 file changed +97
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Deploy Pages
2+
3+ # 触发条件,push到main分支或者pull request到main分支
4+ on :
5+ push :
6+ branches : [main]
7+ pull_request :
8+ branches : [main]
9+
10+ # 支持手动在工作流上触发
11+ workflow_dispatch :
12+
13+ # 设置时区
14+ env :
15+ TZ : Asia/Shanghai
16+
17+ # 权限设置
18+ permissions :
19+ # 允许读取仓库内容的权限。
20+ contents : read
21+ # 允许写入 GitHub Pages 的权限。
22+ pages : write
23+ # 允许写入 id-token 的权限。
24+ id-token : write
25+
26+ # 并发控制配置
27+ concurrency :
28+ group : pages
29+ cancel-in-progress : false
30+
31+ # 定义执行任务
32+ jobs :
33+ # 构建任务
34+ build :
35+
36+ runs-on : ubuntu-latest
37+
38+ # node v20 运行
39+ strategy :
40+ matrix :
41+ node-version : [20]
42+
43+ steps :
44+ # 拉取代码
45+ - name : Checkout
46+ uses : actions/checkout@v3
47+ with :
48+ # 保留 Git 信息
49+ fetch-depth : 0
50+
51+ # 设置使用 Node.js 版本
52+ - name : Use Node.js ${{ matrix.node-version }}
53+ uses : actions/setup-node@v3
54+ with :
55+ node-version : ${{ matrix.node-version }}
56+
57+ # 使用 最新的 PNPM
58+ # 你也可以指定为具体的版本
59+ - uses : pnpm/action-setup@v2
60+ name : Install pnpm
61+ with :
62+ version : latest
63+ # version: 9
64+ run_install : false
65+
66+ # 安装依赖
67+ - name : Install dependencies
68+ run : pnpm install --frozen-lockfile
69+
70+ # 构建项目
71+ - name : Build blog project
72+ run : |
73+ echo ${{ github.workspace }}
74+ pnpm build
75+
76+ # 资源拷贝
77+ - name : Build with Jekyll
78+ uses : actions/jekyll-build-pages@v1
79+ with :
80+ source : ./docs/.vitepress/dist
81+ destination : ./_site
82+
83+ # 上传 _site 的资源,用于后续部署
84+ - name : Upload artifact
85+ uses : actions/upload-pages-artifact@v3
86+
87+ # 部署任务
88+ deploy :
89+ environment :
90+ name : github-pages
91+ url : ${{ steps.deployment.outputs.page_url }}
92+ runs-on : ubuntu-latest
93+ needs : build
94+ steps :
95+ - name : Deploy to GitHub Pages
96+ id : deployment
97+ uses : actions/deploy-pages@v4
You can’t perform that action at this time.
0 commit comments