Merge pull request #118 from qianmoQ/dev-26.4.0 #111
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 docs to GitHub Pages | |
| on: | |
| push: | |
| # 限定分支触发,排除标签:发布打的 tag 会触发部署,但 github-pages | |
| # 环境保护规则不允许从 tag 部署,导致 deploy 被拒。 | |
| branches: [ '**' ] | |
| paths: [ 'docs/**', '.github/workflows/docs.yml' ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # 同一时间只跑一个部署,新提交自动取消进行中的旧部署 | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: docs | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| cache-dependency-path: docs/pnpm-lock.yaml | |
| - name: Install dependencies | |
| # 用 --no-frozen-lockfile:docs 为独立子项目,pnpm 在 CI 中会向上读到根 | |
| # package.json 的 overrides 导致 frozen 校验失败;文档站构建无需锁定一致性。 | |
| run: pnpm install --no-frozen-lockfile | |
| - name: Build | |
| run: pnpm build | |
| - uses: actions/configure-pages@v5 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| # 用绝对路径:job 设了 working-directory: docs,upload-pages-artifact 内部 | |
| # 的 tar 会继承该目录,相对路径 docs/dist 会被当成 docs/docs/dist 而找不到。 | |
| path: ${{ github.workspace }}/docs/dist | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |