|
1 | | -# 构建 VitePress 站点并将其部署到 GitHub Pages 的示例工作流程 |
2 | | -# |
3 | | -name: Deploy VitePress site to Pages |
| 1 | +# Simple workflow for deploying static content to GitHub Pages |
| 2 | +name: Deploy static content to Pages |
4 | 3 |
|
5 | 4 | on: |
6 | | - # 在针对 `main` 分支的推送上运行。如果你 |
7 | | - # 使用 `master` 分支作为默认分支,请将其更改为 `master` |
| 5 | + # Runs on pushes targeting the default branch |
8 | 6 | push: |
9 | | - branches: [master] |
| 7 | + branches: ["main"] |
10 | 8 |
|
11 | | - # 允许你从 Actions 选项卡手动运行此工作流程 |
| 9 | + # Allows you to run this workflow manually from the Actions tab |
12 | 10 | workflow_dispatch: |
13 | 11 |
|
14 | | -# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages |
| 12 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
15 | 13 | permissions: |
16 | 14 | contents: read |
17 | 15 | pages: write |
18 | 16 | id-token: write |
19 | 17 |
|
20 | | -# 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列 |
21 | | -# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成 |
| 18 | +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
| 19 | +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
22 | 20 | concurrency: |
23 | | - group: pages |
| 21 | + group: "pages" |
24 | 22 | cancel-in-progress: false |
25 | 23 |
|
26 | 24 | jobs: |
27 | | - # 构建工作 |
28 | | - build: |
| 25 | + # Single deploy job since we're just deploying |
| 26 | + deploy: |
| 27 | + environment: |
| 28 | + name: github-pages |
| 29 | + url: ${{ steps.deployment.outputs.page_url }} |
29 | 30 | runs-on: ubuntu-latest |
30 | 31 | steps: |
31 | 32 | - name: Checkout |
32 | 33 | 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 | 34 | - 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 |
| 35 | + uses: actions/configure-pages@v5 |
48 | 36 | - name: Upload artifact |
49 | 37 | uses: actions/upload-pages-artifact@v3 |
50 | 38 | with: |
51 | | - path: ./site/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: |
| 39 | + # Upload entire repository |
| 40 | + path: './site/docs/.vitepress/dist' |
62 | 41 | - name: Deploy to GitHub Pages |
63 | 42 | id: deployment |
64 | 43 | uses: actions/deploy-pages@v4 |
0 commit comments