fix(ci): copy README.md to docs/ for honkit build #6
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 | |
| on: | |
| push: | |
| branches: [master, main] | |
| paths: | |
| - "docs/**" | |
| - "examples/*/README.md" | |
| - "README.md" | |
| - "README.zh-CN.md" | |
| - "SUMMARY.md" | |
| - "CONTRIBUTING.md" | |
| - "CONTRIBUTING.zh.md" | |
| - ".gitbook.yaml" | |
| - ".github/workflows/pages.yml" | |
| - "changelog/**" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: | | |
| docs | |
| examples/01-cmake-modern/README.md | |
| examples/02-memory-cache/README.md | |
| examples/03-modern-cpp/README.md | |
| examples/04-simd-vectorization/README.md | |
| examples/05-concurrency/README.md | |
| changelog | |
| README.md | |
| README.zh-CN.md | |
| SUMMARY.md | |
| CONTRIBUTING.md | |
| CONTRIBUTING.zh.md | |
| .gitbook.yaml | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: 'npm' | |
| cache-dependency-path: docs/package-lock.json | |
| - name: Install honkit | |
| working-directory: docs | |
| run: npm ci | |
| - name: Prepare docs for honkit | |
| run: | | |
| # Copy README.md to docs/ for honkit (it expects README in the working directory) | |
| cp README.md docs/README.md | |
| # Copy SUMMARY.md to docs/ for honkit | |
| cp SUMMARY.md docs/SUMMARY.md | |
| # Copy other root-level docs that SUMMARY.md references | |
| cp CONTRIBUTING.md docs/CONTRIBUTING.md || true | |
| cp CONTRIBUTING.zh.md docs/CONTRIBUTING.zh.md || true | |
| cp CHANGELOG.md docs/CHANGELOG.md || true | |
| - name: Build docs | |
| working-directory: docs | |
| run: npx honkit build . ../_site | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: _site | |
| 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 |