Skip to content

Commit 75bc4b2

Browse files
author
huyutao
committed
修改deploy
1 parent 5f68adf commit 75bc4b2

File tree

1 file changed

+55
-24
lines changed

1 file changed

+55
-24
lines changed

.github/workflows/deploy.yml

Lines changed: 55 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,64 @@
1+
# 构建 VitePress 站点并将其部署到 GitHub Pages 的示例工作流程
2+
#
13
name: Deploy VitePress site to Pages
2-
# 在针对main分支的推送上运行。如果使用master分支作为默认分支,请将其更改为master
4+
35
on:
6+
# 在针对 `main` 分支的推送上运行。如果你
7+
# 使用 `master` 分支作为默认分支,请将其更改为 `master`
48
push:
5-
branches:
6-
- main
7-
# 允许你从Actions选项卡手动运行此工作流程
9+
branches: [main]
10+
11+
# 允许你从 Actions 选项卡手动运行此工作流程
812
workflow_dispatch:
9-
# 设置GITHUB_TOKEN的权限,以允许部署到GitHub Pages
13+
14+
# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages
1015
permissions:
11-
pages: write
1216
contents: read
17+
pages: write
18+
id-token: write
19+
1320
# 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列
1421
# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成
1522
concurrency:
16-
group: "pages"
17-
cancel-in-progress: true
18-
runs-on: ubuntu-latest
19-
steps:
20-
- name: Checkout
21-
uses: actions/checkout@v4
22-
fetch-depth: 0
23-
- name: Setup Node
24-
uses: actions/setup-node@v4
25-
with:
26-
node-version: "lts/*"
27-
cache: npm
28-
- name: Install dependencies
29-
run: npm ci
30-
- name: Build with VitePress
31-
run: npm run docs:build
32-
- name: Deploy to GitHub Pages
33-
uses: actions/deploy-pages@v4
23+
group: pages
24+
cancel-in-progress: false
25+
26+
jobs:
27+
# 构建工作
28+
build:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 0 # 如果未启用 lastUpdated,则不需要
35+
# - uses: pnpm/action-setup@v3 # 如果使用 pnpm,请取消注释
36+
# - uses: oven-sh/setup-bun@v1 # 如果使用 Bun,请取消注释
37+
- name: Setup Node
38+
uses: actions/setup-node@v4
39+
with:
40+
node-version: 20
41+
cache: npm # 或 pnpm / yarn
42+
- name: Setup Pages
43+
uses: actions/configure-pages@v4
44+
- name: Install dependencies
45+
run: npm ci # 或 pnpm install / yarn install / bun install
46+
- name: Build with VitePress
47+
run: npm run docs:build # 或 pnpm docs:build / yarn docs:build / bun run docs:build
48+
- name: Upload artifact
49+
uses: actions/upload-pages-artifact@v3
50+
with:
51+
path: docs/.vitepress/dist
52+
53+
# 部署工作
54+
deploy:
55+
environment:
56+
name: github-pages
57+
url: ${{ steps.deployment.outputs.page_url }}
58+
needs: build
59+
runs-on: ubuntu-latest
60+
name: Deploy
61+
steps:
62+
- name: Deploy to GitHub Pages
63+
id: deployment
64+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)