Skip to content

Commit f5ea06d

Browse files
committed
ci: new deploy workflow
1 parent 6736e47 commit f5ea06d

File tree

2 files changed

+48
-28
lines changed

2 files changed

+48
-28
lines changed

.github/workflows/build-check.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: build-check
22

33
on:
44
push:
5-
branches: [ "master" ]
5+
branches: ["master"]
66
pull_request:
7-
branches: [ "master" ]
7+
branches: ["master"]
88

99
jobs:
1010
deploy-gh-pages:
@@ -16,19 +16,19 @@ jobs:
1616
fetch-depth: 0
1717
# 如果你文档需要 Git 子模块,取消注释下一行
1818
# submodules: true
19-
- name: 设置 Node.js
19+
- name: Install pnpm
20+
run: npm install -g pnpm
21+
22+
- name: Set up Node
2023
uses: actions/setup-node@v3
2124
with:
22-
node-version: 18
23-
cache: npm
24-
25-
- name: 安装pnpm
26-
run : npm install -g pnpm
25+
node-version: 20
26+
cache: pnpm
2727

28-
- name: 安装依赖
28+
- name: Install dependencies
2929
run: pnpm install --frozen-lockfile
3030

31-
- name: 构建文档
31+
- name: Build
3232
env:
3333
NODE_OPTIONS: --max_old_space_size=8192
3434
run: |-

.github/workflows/deploy-docs.yml

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
11
name: 部署文档
22

33
on:
4+
# 仅在推送到默认分支时运行。
45
push:
5-
branches:
6-
# 确保这是你正在使用的分支名称
7-
- master
6+
branches: ["master"]
7+
8+
# 这个选项可以使你手动在 Action tab 页面触发工作流
9+
workflow_dispatch:
10+
11+
# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages。
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
# 允许一个并发的部署
18+
concurrency:
19+
group: "pages"
20+
cancel-in-progress: true
821

922
jobs:
1023
deploy-gh-pages:
24+
environment:
25+
name: github-pages
26+
url: ${{ steps.deployment.outputs.page_url }}
1127
runs-on: ubuntu-latest
1228
steps:
1329
- name: Checkout
@@ -16,31 +32,35 @@ jobs:
1632
fetch-depth: 0
1733
# 如果你文档需要 Git 子模块,取消注释下一行
1834
# submodules: true
19-
- name: 设置 Node.js
35+
- name: Install pnpm
36+
run: npm install -g pnpm
37+
38+
- name: Set up Node
2039
uses: actions/setup-node@v3
2140
with:
22-
node-version: 18
23-
cache: npm
24-
25-
- name: 安装pnpm
26-
run : npm install -g pnpm
41+
node-version: 20
42+
cache: pnpm
2743

28-
- name: 安装依赖
44+
- name: Install dependencies
2945
run: pnpm install --frozen-lockfile
3046

31-
- name: 构建文档
47+
- name: Build
3248
env:
3349
NODE_OPTIONS: --max_old_space_size=8192
3450
run: |-
3551
pnpm docs:build
3652
> src/.vuepress/dist/.nojekyll
3753
38-
- name: 复制google认证文件
54+
- name: Copy Google Auth File
3955
run: cp src/.vuepress/public/google0125794c904df104.html src/.vuepress/dist
40-
41-
- name: 部署文档
42-
uses: JamesIves/github-pages-deploy-action@v4
56+
57+
- name: Setup Pages
58+
uses: actions/configure-pages@v4
59+
- name: Upload artifact
60+
uses: actions/upload-pages-artifact@v3
4361
with:
44-
# 这是文档部署到的分支名称
45-
branch: gh-pages
46-
folder: src/.vuepress/dist
62+
# Upload dist folder
63+
path: "./src/.vuepress/dist"
64+
- name: Deploy to GitHub Pages
65+
id: deployment
66+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)