修改目录 #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 部署VitePress | |
on: | |
push: | |
branches: | |
- main # 这段是在推送到 docs 分支时触发该命令 | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
ref: main # 这一步检查 docs 代码 | |
- name: Setup Node.js and pnpm | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "22.2.0" # 设置 nodejs 的版本 | |
- name: Install pnpm | |
run: npm install -g pnpm # 全局安装 pnpm | |
- name: Install dependencies | |
run: pnpm install # 使用 pnpm 安装依赖 | |
- name: Build VitePress | |
run: pnpm run docs:build # 这里是打包 vitepress 命令 | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.NUANXINPRO}} # 这一步很重要,单独看下面的大步骤,主要是用来给该脚本一些仓库权限 | |
publish_dir: .vitepress/dist # 指定该文件夹中的 dist | |
publish_branch: gh-pages # 推送到关联仓库的 gh-pages 分支 | |
dotfiles: true # 包括在提交中,即使被 .gitignore 文件忽略 |