From 602c3fef91336e21340bf223ce0284669a5f7871 Mon Sep 17 00:00:00 2001 From: Alexander Goscinski Date: Tue, 3 Dec 2024 09:20:14 +0100 Subject: [PATCH] Fixes publish plubish-docs build (pygraphviz build failure) (#58) One needs to install graphviz over the system package manager before installing pygraphviz to prevent an automatic build that fails. This can is achieved with `sudo apt-get install graphviz graphviz-dev`. The `--force` was in `hatch run docs:deploy --force` was ignored. hatch does not support arguments so we directly use it in the hatch-script definition. Replacing `--force` to ``--no-history`.` See https://github.com/pypa/hatch/discussions/988 We also add the `workflow_dispatch` event so we can run the workflow manually. --- .github/workflows/publish-docs.yml | 25 +++++++++++++++++++------ pyproject.toml | 2 +- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 0264f5a..a2e630c 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -3,6 +3,7 @@ on: push: branches: - main + workflow_dispatch: permissions: contents: write @@ -10,6 +11,11 @@ permissions: jobs: deploy: runs-on: ubuntu-latest + timeout-minutes: 30 + strategy: + matrix: + python-version: ['3.12'] + steps: - uses: actions/checkout@v4 @@ -18,13 +24,21 @@ jobs: run: | git config user.name github-actions[bot] git config user.email github-actions[bot]@users.noreply.github.com - - - uses: actions/setup-python@v5 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 with: - python-version: 3.12 + python-version: ${{ matrix.python-version }} + + - name: Install hatch + run: | + pip install --upgrade pip + pip install hatch - - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + - name: Install Graphviz + run: sudo apt-get install graphviz graphviz-dev + # caches the build docs + # see https://squidfunk.github.io/mkdocs-material/plugins/requirements/caching/ - uses: actions/cache@v4 with: key: mkdocs-material-${{ env.cache_id }} @@ -34,5 +48,4 @@ jobs: - name: "Build and deploy docs to gh-pages" run: | - pip install hatch - hatch run docs:deploy --force + hatch run docs:deploy diff --git a/pyproject.toml b/pyproject.toml index 7ef89cc..d5863fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -95,5 +95,5 @@ serve = [ ] deploy = [ - "mkdocs gh-deploy -f docs/mkdocs.yml" + "mkdocs gh-deploy --no-history -f docs/mkdocs.yml" ]