Deploy Docs #75
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
| # Deploy unified MPCP docs to https://mpcp-protocol.github.io/ | |
| # Site structure: / (landing) | /spec | /reference | |
| # | |
| # CRITICAL: Settings → Pages → Source: Deploy from a branch | |
| # Branch: gh-pages | Folder: / (root) | |
| # If you use "main", only the landing page will load (404 on /spec, /reference) | |
| name: Deploy Docs | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| repository_dispatch: | |
| types: [deploy-docs] | |
| permissions: | |
| contents: write | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout org site | |
| uses: actions/checkout@v4 | |
| - name: Checkout mpcp-spec | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: mpcp-protocol/mpcp-spec | |
| path: mpcp-spec | |
| token: ${{ secrets.MPCP_DEPLOY_TOKEN }} | |
| - name: Checkout mpcp-reference | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: mpcp-protocol/mpcp-reference | |
| path: mpcp-reference | |
| token: ${{ secrets.MPCP_DEPLOY_TOKEN }} | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install MkDocs | |
| run: pip install -r docs-requirements.txt | |
| - name: Build spec | |
| run: | | |
| cd mpcp-spec | |
| mkdocs build --config-file mkdocs.yml --strict | |
| mv site ../_site_spec | |
| - name: Build reference | |
| run: | | |
| cd mpcp-reference | |
| mkdocs build --config-file mkdocs.unified.yml --strict | |
| mv site ../_site_reference | |
| - name: Assemble site | |
| run: | | |
| mkdir -p site | |
| cp index.html site/ | |
| cp -r assets site/ | |
| cp -r _site_spec site/spec | |
| cp -r _site_reference site/reference | |
| touch site/.nojekyll | |
| test -f site/spec/index.html || (echo "Missing site/spec/index.html" && exit 1) | |
| test -f site/reference/index.html || (echo "Missing site/reference/index.html" && exit 1) | |
| echo "Site structure OK" | |
| find site -name index.html | head -20 | |
| - name: Deploy to GitHub Pages (gh-pages branch) | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./site |