Skip to content

Commit d9895ae

Browse files
committed
chore: update workflow
1 parent 1cac4b2 commit d9895ae

File tree

1 file changed

+24
-51
lines changed

1 file changed

+24
-51
lines changed

.github/workflows/deploy.yml

+24-51
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,49 @@
1-
# 构建 VitePress 站点并将其部署到 GitHub Pages 的示例工作流程
2-
#
3-
name: Deploy VitePress site to Pages
1+
name: Build and deploy
42

53
on:
6-
# 在针对 `main` 分支的推送上运行。如果你
7-
# 使用 `master` 分支作为默认分支,请将其更改为 `master`
84
push:
95
branches: [main]
10-
11-
# 允许你从 Actions 选项卡手动运行此工作流程
126
workflow_dispatch:
137

14-
# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages
15-
permissions:
16-
contents: read
17-
pages: write
18-
id-token: write
19-
20-
# 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列
21-
# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成
22-
concurrency:
23-
group: pages
24-
cancel-in-progress: false
25-
268
jobs:
27-
# 构建工作
28-
build:
9+
docs:
2910
runs-on: ubuntu-latest
11+
3012
steps:
31-
- name: Checkout
32-
uses: actions/checkout@v4
13+
- uses: actions/checkout@v4
3314
with:
34-
fetch-depth: 0 # 如果未启用 lastUpdated,则不需要
35-
# - uses: pnpm/action-setup@v3 # 如果使用 pnpm,请取消此区域注释
36-
# with:
37-
# version: 9
38-
# - uses: oven-sh/setup-bun@v1 # 如果使用 Bun,请取消注释
39-
- name: Setup Node
15+
fetch-depth: 0
16+
17+
- name: Setup Node.js
4018
uses: actions/setup-node@v4
4119
with:
4220
node-version: 22
43-
cache: npm # 或 pnpm / yarn
21+
cache: npm
22+
4423
- name: Setup Pages
4524
uses: actions/configure-pages@v4
25+
4626
- name: Install dependencies
47-
run: npm ci # 或 pnpm install / yarn install / bun install
27+
run: npm ci
28+
4829
- name: Build with VitePress
49-
run: npm run docs:build # 或 pnpm docs:build / yarn docs:build / bun run docs:build
50-
- name: Upload artifact
51-
uses: actions/upload-pages-artifact@v3
52-
with:
53-
path: docs/.vitepress/dist
30+
run: npm run docs:build
5431

55-
# 部署工作
56-
deploy:
57-
environment:
58-
name: github-pages
59-
url: ${{ steps.deployment.outputs.page_url }}
60-
needs: build
61-
runs-on: ubuntu-latest
62-
name: Deploy
63-
steps:
6432
- name: Deploy to GitHub Pages
65-
id: deployment
66-
uses: actions/deploy-pages@v4
67-
68-
# 同步到 Gitee
69-
sync:
33+
uses: crazy-max/ghaction-github-pages@v4
34+
with:
35+
target_branch: gh-pages
36+
build_dir: docs/.vitepress/dist
37+
fqdn: java.doocs.org
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
41+
build:
7042
runs-on: ubuntu-latest
7143
if: github.repository == 'doocs/advanced-java'
44+
needs: docs
7245
steps:
73-
- name: Sync To Gitee
46+
- name: Sync to Gitee
7447
uses: wearerequired/git-mirror-action@master
7548
env:
7649
SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }}

0 commit comments

Comments
 (0)