File tree Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change 17
17
push :
18
18
branches :
19
19
- master
20
+ # 设置时区
21
+ env :
22
+ TZ : Asia/Shanghai
20
23
# 任务列表
21
24
jobs :
22
25
build-and-deploy :
@@ -32,24 +35,35 @@ jobs:
32
35
# 步骤2:检出代码
33
36
- name : Checkout
34
37
uses : actions/checkout@v4
38
+ with :
39
+ # 保留 Git 信息
40
+ fetch-depth : 0
35
41
# 步骤3:安装yarn
36
42
- name : Install yarn
37
43
run : npm install -g yarn
44
+ # 步骤n:删除node_modules,替换或更新包时使用
45
+ # - name: Delete node_modules
46
+ # run: rm -fr node_modules
38
47
# 步骤4:安装依赖
39
48
- name : Install dependencies
40
49
run : yarn install
41
- # 步骤5:构建VitePress
50
+ # 步骤5:删除cache和dist
51
+ - name : Clean up cache and dist
52
+ run : |
53
+ rm -rf Docs/.vitepress/cache
54
+ rm -rf Docs/.vitepress/dist
55
+ # 步骤6:构建VitePress
42
56
- name : Build VitePress
43
- run : yarn run docs: build
44
- # 步骤6 :部署到Github Pages
57
+ run : yarn run build
58
+ # 步骤7 :部署到Github Pages
45
59
# - name: Deploy to Github Pages
46
60
# uses: peaceiris/actions-gh-pages@v3
47
61
# with:
48
62
# github_token: ${{ secrets.VITEPRESS_BLOG_TOKEN }} # 自定义的action环境变量
49
63
# publish_dir: .vitepress/dist # 指定部署目录
50
64
# publish_branch: gh-pages # 指定部署分支
51
65
# dotfiles: true # 允许使用.gitignore文件
52
- # 步骤7 : scp部署到 vps
66
+ # 步骤8 : scp部署到 vps
53
67
- name : Deploy to VPS
54
68
uses : appleboy/scp-action@master
55
69
with :
59
73
key : ${{ secrets.SERVER_SSH_KEY }} # 服务器SSH 密钥
60
74
# password: ${{ secrets.SERVER_USER_PASSWORD }} # 服务器用户密码
61
75
strip_components : 2 # 跳过指定目录
62
- source : ' .vitepress/dist' # 源目录
76
+ source : ' Docs/ .vitepress/dist' # 源目录
63
77
target : ${{ secrets.SERVER_TARGET }} # 目标目录
78
+
64
79
```
65
80
66
81
## 配置 Action 环境变量
You can’t perform that action at this time.
0 commit comments