From eedb575c902b22f4863e8528c734ebc0c4485fee Mon Sep 17 00:00:00 2001 From: Albert Hui Date: Tue, 28 Jul 2026 22:45:15 +0800 Subject: [PATCH] fix(ci): deploy docs via the GitHub Actions Pages pipeline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pages source is 'GitHub Actions' but docs.yml used mkdocs gh-deploy (branch push), which a workflow-source Pages ignores — the site was stalled. Switch to mkdocs build --strict -> upload-pages-artifact -> deploy-pages. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/docs.yml | 61 +++++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index ccbe4ee..934c623 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -3,29 +3,68 @@ name: Docs on: push: branches: [main] + paths: + - 'docs/**' + - 'mkdocs.yml' + - 'README.md' + - '.github/workflows/docs.yml' + pull_request: + paths: + - 'docs/**' + - 'mkdocs.yml' + - 'README.md' + - '.github/workflows/docs.yml' workflow_dispatch: permissions: - contents: write + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: false jobs: - deploy: - name: Build and deploy MkDocs + build: + name: Build MkDocs site runs-on: ubuntu-latest - steps: - - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + - name: Checkout + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 - name: Setup Python uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + with: + python-version: '3.x' - name: Install MkDocs Material - run: pip install mkdocs-material + run: | + set -euo pipefail + python3 -m pip install --upgrade pip + python3 -m pip install mkdocs mkdocs-material + + - name: Build site (strict) + run: mkdocs build --strict --site-dir site - - name: Build (strict) - run: mkdocs build --strict + - name: Upload Pages artifact + if: github.ref == 'refs/heads/main' + uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 + with: + path: site + + deploy: + name: Deploy to GitHub Pages + if: github.ref == 'refs/heads/main' + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Setup Pages + uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0 - name: Deploy to GitHub Pages - run: mkdocs gh-deploy --force - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + id: deployment + uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0