Merge branch 'main' into docs #87
This file contains hidden or 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: Deploy to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - docs # 监听 main 分支的提交 | |
| permissions: # 设置权限 | |
| contents: write # 允许写入内容 | |
| pages: write # 允许写入 GitHub Pages | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 检出代码 | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| # 设置 Node.js 环境 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 20 # 更新为更高版本的 Node.js | |
| # 安装 pnpm | |
| - name: Install pnpm | |
| run: npm install -g pnpm | |
| # 安装依赖 | |
| - name: Install dependencies | |
| run: pnpm install | |
| # 构建项目 | |
| - name: Build project | |
| run: pnpm docs:build | |
| # 部署到 GitHub Pages | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./docs/.vitepress/dist # 构建输出目录 |