From 4e61df67a311b620b476ef326e32412665374faa Mon Sep 17 00:00:00 2001 From: FBumann <117816358+FBumann@users.noreply.github.com> Date: Tue, 9 Dec 2025 22:20:50 +0100 Subject: [PATCH 1/3] Extract docs build into separate workflow --- .github/workflows/docs.yaml | 108 +++++++++++++++++++++++++++++++++ .github/workflows/release.yaml | 38 ++---------- 2 files changed, 112 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/docs.yaml diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 000000000..ebb208468 --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,108 @@ +name: Docs + +on: + push: + branches: [main] + paths: + - 'docs/**' + - 'mkdocs.yml' + - 'flixopt/**' + pull_request: + paths: + - 'docs/**' + - 'mkdocs.yml' + workflow_dispatch: + workflow_call: + inputs: + deploy: + type: boolean + default: false + version: + type: string + required: false + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + PYTHON_VERSION: "3.11" + MPLBACKEND: Agg + PLOTLY_RENDERER: json + +jobs: + build: + name: Build documentation + runs-on: ubuntu-24.04 + timeout-minutes: 30 + steps: + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - uses: astral-sh/setup-uv@v6 + with: + version: "0.9.10" + enable-cache: true + + - uses: actions/setup-python@v6 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Extract changelog + run: | + uv pip install --system packaging + python scripts/extract_changelog.py + + - name: Install dependencies + run: uv pip install --system ".[docs]" + + - name: Build docs + run: mkdocs build --strict + + - uses: actions/upload-artifact@v4 + with: + name: docs + path: site/ + retention-days: 7 + + deploy: + name: Deploy documentation + needs: build + if: inputs.deploy == true + runs-on: ubuntu-24.04 + permissions: + contents: write + steps: + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - uses: astral-sh/setup-uv@v6 + with: + version: "0.9.10" + enable-cache: true + + - uses: actions/setup-python@v6 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Extract changelog + run: | + uv pip install --system packaging + python scripts/extract_changelog.py + + - name: Install dependencies + run: uv pip install --system ".[docs]" + + - name: Configure Git + run: | + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + + - name: Deploy docs + run: | + VERSION=${{ inputs.version }} + VERSION=${VERSION#v} + mike deploy --push --update-aliases $VERSION latest + mike set-default --push latest diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4f1edd3e8..2bf49bfc1 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -188,37 +188,7 @@ jobs: name: Deploy documentation needs: [create-release] if: "!contains(github.ref, 'alpha') && !contains(github.ref, 'beta') && !contains(github.ref, 'rc')" - runs-on: ubuntu-24.04 - permissions: - contents: write - steps: - - uses: actions/checkout@v5 - with: - fetch-depth: 0 - - - uses: astral-sh/setup-uv@v6 - with: - version: "0.9.10" - - - uses: actions/setup-python@v6 - with: - python-version: ${{ env.PYTHON_VERSION }} - - - name: Extract changelog - run: | - uv pip install --system packaging - python scripts/extract_changelog.py - - - name: Install docs dependencies - run: uv pip install --system ".[docs]" - - - name: Configure Git - run: | - git config user.name github-actions[bot] - git config user.email 41898282+github-actions[bot]@users.noreply.github.com - - - name: Deploy docs - run: | - VERSION=${GITHUB_REF#refs/tags/v} - mike deploy --push --update-aliases $VERSION latest - mike set-default --push latest + uses: ./.github/workflows/docs.yaml + with: + deploy: true + version: ${{ github.ref_name }} From 66f6eedc1068029982cff26245dd8cfca98a0de5 Mon Sep 17 00:00:00 2001 From: FBumann <117816358+FBumann@users.noreply.github.com> Date: Tue, 9 Dec 2025 22:26:35 +0100 Subject: [PATCH 2/3] Fix workflow --- .github/workflows/docs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index ebb208468..d8a5e45aa 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -69,7 +69,7 @@ jobs: deploy: name: Deploy documentation needs: build - if: inputs.deploy == true + if: ${{ inputs.deploy == true }} runs-on: ubuntu-24.04 permissions: contents: write From b7baaea652107b9d03ec8f63917929206f1d57ca Mon Sep 17 00:00:00 2001 From: FBumann <117816358+FBumann@users.noreply.github.com> Date: Wed, 10 Dec 2025 09:15:26 +0100 Subject: [PATCH 3/3] docs deploy job uses the uploaded artifact --- .github/workflows/docs.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index d8a5e45aa..d5fdc5b00 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -87,22 +87,22 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} - - name: Extract changelog - run: | - uv pip install --system packaging - python scripts/extract_changelog.py + - name: Install mike + run: uv pip install --system mike - - name: Install dependencies - run: uv pip install --system ".[docs]" + - uses: actions/download-artifact@v4 + with: + name: docs + path: site/ - name: Configure Git run: | - git config user.name github-actions[bot] - git config user.email 41898282+github-actions[bot]@users.noreply.github.com + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - name: Deploy docs run: | VERSION=${{ inputs.version }} VERSION=${VERSION#v} - mike deploy --push --update-aliases $VERSION latest + mike deploy --push --update-aliases --no-build $VERSION latest mike set-default --push latest