Skip to content

Commit 864beca

Browse files
authored
Create deploy.yml
1 parent c42c3a5 commit 864beca

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# 构建 VitePress 站点并将其部署到 GitHub Pages 的示例工作流程
2+
#
3+
name: Deploy VitePress site to Pages
4+
5+
on:
6+
# 在针对 `main` 分支的推送上运行。如果你
7+
# 使用 `master` 分支作为默认分支,请将其更改为 `master`
8+
push:
9+
branches: [main]
10+
11+
# 允许你从 Actions 选项卡手动运行此工作流程
12+
workflow_dispatch:
13+
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+
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
35+
- uses: pnpm/action-setup@v3
36+
- name: Setup Node
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: 20
40+
cache: pnpm
41+
- name: Setup Pages
42+
uses: actions/configure-pages@v4
43+
- name: Install dependencies
44+
run: pnpm install
45+
- name: Build with VitePress
46+
run: pnpm build
47+
- name: Upload artifact
48+
uses: actions/upload-pages-artifact@v3
49+
with:
50+
path: docs/.vitepress/dist
51+
52+
# 部署工作
53+
deploy:
54+
environment:
55+
name: github-pages
56+
url: ${{ steps.deployment.outputs.page_url }}
57+
needs: build
58+
runs-on: ubuntu-latest
59+
name: Deploy
60+
steps:
61+
- name: Deploy to GitHub Pages
62+
id: deployment
63+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)