From 8467bdcf70ecca923fe59661165931cfd2bd3de7 Mon Sep 17 00:00:00 2001 From: Hao Date: Tue, 5 Nov 2024 19:10:12 -0800 Subject: [PATCH] add website auto build workflow for mkdocs --- .github/workflows/docs.yml | 52 +++++++++++--------------------------- 1 file changed, 15 insertions(+), 37 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 7eda337..d60d965 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,50 +1,28 @@ name: website - -# build the documentation whenever there are new commits on main on: push: branches: - main - - docs/* - # Alternative: only build for tags. - # tags: - # - '*' - -# security: restrict permissions for CI jobs. permissions: - contents: read - + contents: write jobs: - # Build the documentation and upload the static HTML files as an artifact. - build: + deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Configure Git Credentials + run: | + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com - uses: actions/setup-python@v5 with: - python-version: '3.13' - - # ADJUST THIS: install all dependencies (including pdoc) - - run: pip install uv - # ADJUST THIS: build your documentation into docs/. - # We use a custom build script for pdoc itself, ideally you just run `pdoc -o docs/ ...` here. - - run: uv run --extra doc pdoc --output docs --mermaid aact - - - uses: actions/upload-pages-artifact@v3 + python-version: 3.12 + - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + - uses: actions/cache@v4 with: - path: docs/ - - # Deploy the artifact to GitHub pages. - # This is a separate job so that only actions/deploy-pages has the necessary permissions. - deploy: - needs: build - runs-on: ubuntu-latest - permissions: - pages: write - id-token: write - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - steps: - - id: deployment - uses: actions/deploy-pages@v4 + key: mkdocs-material-${{ env.cache_id }} + path: .cache + restore-keys: | + mkdocs-material- + - run: pip install uv + - run: uv run mike gh-deploy --force