File tree Expand file tree Collapse file tree 1 file changed +23
-11
lines changed
Expand file tree Collapse file tree 1 file changed +23
-11
lines changed Original file line number Diff line number Diff line change 1+ # 构建 VitePress 站点并将其部署到 GitHub Pages 的示例工作流程
2+ #
13name : Deploy VitePress site to Pages
24
35on :
6+ # 在针对 `main` 分支的推送上运行。如果你
7+ # 使用 `master` 分支作为默认分支,请将其更改为 `master`
48 push :
59 branches : [main]
10+
11+ # 允许你从 Actions 选项卡手动运行此工作流程
612 workflow_dispatch :
713
14+ # 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages
815permissions :
916 contents : read
1017 pages : write
1118 id-token : write
1219
20+ # 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列
21+ # 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成
1322concurrency :
1423 group : pages
1524 cancel-in-progress : false
1625
1726jobs :
27+ # 构建工作
1828 build :
1929 runs-on : ubuntu-latest
2030 steps :
2131 - name : Checkout
2232 uses : actions/checkout@v4
23-
33+ 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,请取消注释
2439 - name : Setup Node
2540 uses : actions/setup-node@v4
2641 with :
2742 node-version : 22
28-
29- - name : Setup Bun
30- uses : oven-sh/setup-bun@v1
31- with :
32- bun-version : latest
33-
43+ cache : npm # 或 pnpm / yarn
44+ - name : Setup Pages
45+ uses : actions/configure-pages@v4
3446 - name : Install dependencies
35- run : bun install
36-
47+ run : npm ci # 或 pnpm install / yarn install / bun install
3748 - name : Build with VitePress
38- run : bun run docs:build
39-
49+ run : npm run docs:build # 或 pnpm docs:build / yarn docs:build / bun run docs:build
4050 - name : Upload artifact
4151 uses : actions/upload-pages-artifact@v3
4252 with :
4353 path : docs/.vitepress/dist
4454
55+ # 部署工作
4556 deploy :
4657 environment :
4758 name : github-pages
4859 url : ${{ steps.deployment.outputs.page_url }}
4960 needs : build
5061 runs-on : ubuntu-latest
62+ name : Deploy
5163 steps :
5264 - name : Deploy to GitHub Pages
5365 id : deployment
You can’t perform that action at this time.
0 commit comments