|
1 |
| -# Sample workflow for building and deploying a VitePress site to GitHub Pages |
| 1 | +# 构建 VitePress 站点并将其部署到 GitHub Pages 的示例工作流程 |
2 | 2 | #
|
3 | 3 | name: Deploy VitePress site to Pages
|
4 | 4 |
|
5 | 5 | on:
|
6 |
| - # Runs on pushes targeting the `main` branch. Change this to `master` if you're |
7 |
| - # using the `master` branch as the default branch. |
8 |
| - # push: |
9 |
| - # branches: [main] |
| 6 | + # 在针对 `main` 分支的推送上运行。如果你 |
| 7 | + # 使用 `master` 分支作为默认分支,请将其更改为 `master` |
| 8 | + push: |
| 9 | + branches: [main] |
10 | 10 |
|
11 |
| - # Allows you to run this workflow manually from the Actions tab |
| 11 | + # 允许你从 Actions 选项卡手动运行此工作流程 |
12 | 12 | workflow_dispatch:
|
13 | 13 |
|
14 |
| -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 14 | +# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages |
15 | 15 | permissions:
|
16 | 16 | contents: read
|
17 | 17 | pages: write
|
18 | 18 | id-token: write
|
19 | 19 |
|
20 |
| -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
21 |
| -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 20 | +# 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列 |
| 21 | +# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成 |
22 | 22 | concurrency:
|
23 | 23 | group: pages
|
24 | 24 | cancel-in-progress: false
|
25 | 25 |
|
26 | 26 | jobs:
|
27 |
| - # Build job |
| 27 | + # 构建工作 |
28 | 28 | build:
|
29 | 29 | runs-on: ubuntu-latest
|
30 | 30 | steps:
|
31 | 31 | - name: Checkout
|
32 |
| - uses: actions/checkout@v3 |
| 32 | + uses: actions/checkout@v4 |
33 | 33 | with:
|
34 |
| - fetch-depth: 0 # Not needed if lastUpdated is not enabled |
35 |
| - - uses: pnpm/action-setup@v2 # Uncomment this if you're using pnpm |
| 34 | + fetch-depth: 0 # 如果未启用 lastUpdated,则不需要 |
| 35 | + - uses: pnpm/action-setup@v3 # 如果使用 pnpm,请取消注释 |
36 | 36 | with:
|
37 |
| - version: 8 |
38 |
| - # - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun |
| 37 | + version: 9 |
| 38 | + # - uses: oven-sh/setup-bun@v1 # 如果使用 Bun,请取消注释 |
39 | 39 | - name: Setup Node
|
40 |
| - uses: actions/setup-node@v3 |
| 40 | + uses: actions/setup-node@v4 |
41 | 41 | with:
|
42 |
| - node-version: 18 |
43 |
| - cache: pnpm # or pnpm / yarn |
| 42 | + node-version: 20 |
| 43 | + cache: pnpm # 或 pnpm / yarn |
44 | 44 | - name: Setup Pages
|
45 |
| - uses: actions/configure-pages@v3 |
| 45 | + uses: actions/configure-pages@v4 |
46 | 46 | - name: Install dependencies
|
47 |
| - run: pnpm install # or pnpm install / yarn install / bun install |
| 47 | + run: pnpm install # 或 pnpm install / yarn install / bun install |
48 | 48 | - name: Build with VitePress
|
49 | 49 | run: |
|
50 |
| - pnpm run build # or pnpm build / yarn build / bun run build |
| 50 | + pnpm run build # 或 pnpm docs:build / yarn docs:build / bun run docs:build |
51 | 51 | touch .vitepress/dist/.nojekyll
|
52 | 52 | - name: Upload artifact
|
53 |
| - uses: actions/upload-pages-artifact@v2 |
| 53 | + uses: actions/upload-pages-artifact@v3 |
54 | 54 | with:
|
55 | 55 | path: .vitepress/dist
|
56 | 56 |
|
57 |
| - # Deployment job |
| 57 | + # 部署工作 |
58 | 58 | deploy:
|
59 | 59 | environment:
|
60 | 60 | name: github-pages
|
|
65 | 65 | steps:
|
66 | 66 | - name: Deploy to GitHub Pages
|
67 | 67 | id: deployment
|
68 |
| - uses: actions/deploy-pages@v2 |
| 68 | + uses: actions/deploy-pages@v4 |
0 commit comments