|
1 | 1 | name: Deploy VuePress site to GitHub Pages |
2 | 2 |
|
3 | 3 | on: |
4 | | - # 每当 push 到 vuepress 分支时触发部署 |
5 | | - push: |
6 | | - branches: |
7 | | - - vuepress |
8 | | - # 手动触发部署 |
9 | | - workflow_dispatch: |
| 4 | + # 每当 push 到 vuepress 分支时触发部署 |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - vuepress |
| 8 | + - main |
| 9 | + # 手动触发部署 |
| 10 | + workflow_dispatch: |
10 | 11 |
|
11 | 12 | jobs: |
12 | | - docs: |
13 | | - runs-on: ubuntu-latest |
| 13 | + docs: |
| 14 | + runs-on: ubuntu-latest |
14 | 15 |
|
15 | | - steps: |
16 | | - - uses: actions/checkout@v4 |
17 | | - with: |
18 | | - # “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录 |
19 | | - fetch-depth: 0 |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + # “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录 |
| 20 | + fetch-depth: 0 |
20 | 21 |
|
21 | | - - name: Setup pnpm |
22 | | - uses: pnpm/action-setup@v4 |
23 | | - with: |
24 | | - # 选择要使用的 pnpm 版本 (匹配 package.json 中的 packageManager) |
25 | | - version: "10.24.0" |
26 | | - # 使用 pnpm 安装依赖 |
27 | | - run_install: true |
| 22 | + - name: Setup pnpm |
| 23 | + uses: pnpm/action-setup@v4 |
| 24 | + with: |
| 25 | + # 选择要使用的 pnpm 版本 (匹配 package.json 中的 packageManager) |
| 26 | + version: "10.24.0" |
| 27 | + # 使用 pnpm 安装依赖 |
| 28 | + run_install: true |
28 | 29 |
|
29 | | - - name: Setup Node.js |
30 | | - uses: actions/setup-node@v4 |
31 | | - with: |
32 | | - # 选择要使用的 node 版本 |
33 | | - node-version: 22 |
34 | | - # 缓存 pnpm 依赖 |
35 | | - cache: pnpm |
| 30 | + - name: Setup Node.js |
| 31 | + uses: actions/setup-node@v4 |
| 32 | + with: |
| 33 | + # 选择要使用的 node 版本 |
| 34 | + node-version: 22 |
| 35 | + # 缓存 pnpm 依赖 |
| 36 | + cache: pnpm |
36 | 37 |
|
37 | | - # 运行构建脚本 |
38 | | - - name: Build VuePress site |
39 | | - run: pnpm docs:build |
| 38 | + # 运行构建脚本 |
| 39 | + - name: Build VuePress site |
| 40 | + run: pnpm docs:build |
40 | 41 |
|
41 | | - # 查看 workflow 的文档来获取更多信息 |
42 | | - # @see https://github.com/crazy-max/ghaction-github-pages |
43 | | - - name: Deploy to GitHub Pages |
44 | | - uses: crazy-max/ghaction-github-pages@v4 |
45 | | - with: |
46 | | - # 部署到 gh-pages 分支 |
47 | | - target_branch: gh-pages |
48 | | - # 部署目录为 VuePress 的默认输出目录 |
49 | | - build_dir: docs/.vuepress/dist |
50 | | - env: |
51 | | - # @see https://docs.github.com/cn/actions/reference/authentication-in-a-workflow#about-the-github_token-secret |
52 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 42 | + # 查看 workflow 的文档来获取更多信息 |
| 43 | + # @see https://github.com/crazy-max/ghaction-github-pages |
| 44 | + - name: Deploy to GitHub Pages |
| 45 | + uses: crazy-max/ghaction-github-pages@v4 |
| 46 | + with: |
| 47 | + # 部署到 gh-pages 分支 |
| 48 | + target_branch: gh-pages |
| 49 | + # 部署目录为 VuePress 的默认输出目录 |
| 50 | + build_dir: docs/.vuepress/dist |
| 51 | + env: |
| 52 | + # @see https://docs.github.com/cn/actions/reference/authentication-in-a-workflow#about-the-github_token-secret |
| 53 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments