File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change
1
+ # 标题
1
2
name : GitHub Actions 部署 vitepress 博客
3
+ # 触发时机:表示推送master分支时触发
2
4
on :
3
5
push :
4
6
branches :
5
7
- master
8
+ # 任务列表
6
9
jobs :
7
10
build-and-deploy :
11
+ # 运行环境
8
12
runs-on : ubuntu-latest
13
+ # 步骤
9
14
steps :
15
+ # 步骤1:安装Node.js
10
16
- name : Setup Node.js
11
17
uses : actions/setup-node@v4
12
18
with :
13
19
node-version : 20
20
+ # 步骤2:检出代码
14
21
- name : Checkout
15
22
uses : actions/checkout@v4
23
+ # 步骤3:安装yarn
16
24
- name : Install yarn
17
25
run : npm install -g yarn
26
+ # 步骤4:安装依赖
18
27
- name : Install dependencies
19
28
run : yarn install
29
+ # 步骤5:构建VitePress
20
30
- name : Build VitePress
21
31
run : yarn run docs:build
32
+ # 步骤6:部署到Github Pages
22
33
- name : Deploy to Github Pages
23
34
uses : peaceiris/actions-gh-pages@v3
24
35
with :
25
- github_token : ${{ secrets.VITEPRESS_BLOG_TOKEN }}
26
- publish_dir : .vitepress/dist
27
- publish_branch : gh-pages
28
- dotfiles : true
36
+ github_token : ${{ secrets.VITEPRESS_BLOG_TOKEN }} # 自定义的action环境变量
37
+ publish_dir : .vitepress/dist # 指定部署目录
38
+ publish_branch : gh-pages # 指定部署分支
39
+ dotfiles : true # 允许使用.gitignore文件
You can’t perform that action at this time.
0 commit comments