fix(docs-site): 修正 base 路径以用于 GitHub Pages 部署 #10
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
| # 用于部署 VitePress 文档站点到 GitHub Pages 的示例工作流 | |
| name: Deploy VitePress Docs | |
| on: | |
| # 在推送到 main 分支时运行 | |
| push: | |
| branches: [main] | |
| # 允许你从 Actions 选项卡手动运行此工作流 | |
| workflow_dispatch: | |
| # 设置 GITHUB_TOKEN 的权限以允许部署到 GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # 只允许一个并发部署,跳过在进行中运行和最新排队之间的运行。 | |
| # 但是,不要取消进行中的运行,因为我们希望允许这些部署完成。 | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| # 构建任务 | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # 如果未启用 lastUpdated,则不需要 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v1 | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Install dependencies | |
| working-directory: ./docs-site # 指定工作目录 | |
| run: bun install | |
| - name: Build with VitePress | |
| working-directory: ./docs-site # 指定工作目录 | |
| run: | | |
| bun run docs:build | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: docs-site/.vitepress/dist | |
| # 部署任务 | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| needs: build | |
| runs-on: ubuntu-latest | |
| name: Deploy | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |