Skip to content

Commit ca578b6

Browse files
committed
feat: 更新GithubAction yaml
1 parent ac10e3b commit ca578b6

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

Docs/Articles/Node/通过GithubAction将内容部署到vps.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ on:
1717
push:
1818
branches:
1919
- master
20+
# 设置时区
21+
env:
22+
TZ: Asia/Shanghai
2023
# 任务列表
2124
jobs:
2225
build-and-deploy:
@@ -32,24 +35,35 @@ jobs:
3235
# 步骤2:检出代码
3336
- name: Checkout
3437
uses: actions/checkout@v4
38+
with:
39+
# 保留 Git 信息
40+
fetch-depth: 0
3541
# 步骤3:安装yarn
3642
- name: Install yarn
3743
run: npm install -g yarn
44+
# 步骤n:删除node_modules,替换或更新包时使用
45+
# - name: Delete node_modules
46+
# run: rm -fr node_modules
3847
# 步骤4:安装依赖
3948
- name: Install dependencies
4049
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
4256
- name: Build VitePress
43-
run: yarn run docs:build
44-
# 步骤6:部署到Github Pages
57+
run: yarn run build
58+
# 步骤7:部署到Github Pages
4559
# - name: Deploy to Github Pages
4660
# uses: peaceiris/actions-gh-pages@v3
4761
# with:
4862
# github_token: ${{ secrets.VITEPRESS_BLOG_TOKEN }} # 自定义的action环境变量
4963
# publish_dir: .vitepress/dist # 指定部署目录
5064
# publish_branch: gh-pages # 指定部署分支
5165
# dotfiles: true # 允许使用.gitignore文件
52-
# 步骤7: scp部署到 vps
66+
# 步骤8: scp部署到 vps
5367
- name: Deploy to VPS
5468
uses: appleboy/scp-action@master
5569
with:
@@ -59,8 +73,9 @@ jobs:
5973
key: ${{ secrets.SERVER_SSH_KEY }} # 服务器SSH 密钥
6074
# password: ${{ secrets.SERVER_USER_PASSWORD }} # 服务器用户密码
6175
strip_components: 2 # 跳过指定目录
62-
source: '.vitepress/dist' # 源目录
76+
source: 'Docs/.vitepress/dist' # 源目录
6377
target: ${{ secrets.SERVER_TARGET }} # 目标目录
78+
6479
```
6580

6681
## 配置 Action 环境变量

0 commit comments

Comments
 (0)