From 33a64eb5eca5ca17653ed7d455f8aeb335b3f0ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Fri, 21 Feb 2025 06:37:37 +0100 Subject: [PATCH] ci: improve GitHub Actions workflow for website builds (#1151) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # What does this PR do? Refine the existing update-readthedocs.yml workflow to enhance automation and reliability. Updates include: - Expanding path triggers to cover all documentation files (docs/**) and build artifacts. - Adding steps to set up Python (3.11), install uv, sync dependencies, and build HTML using make html. - Ensuring the ReadTheDocs build trigger only runs on workflow_dispatch events. These improvements help validate website builds in PRs, preventing issues before merging. Signed-off-by: Sébastien Han Signed-off-by: Sébastien Han --- .github/workflows/update-readthedocs.yml | 31 +++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-readthedocs.yml b/.github/workflows/update-readthedocs.yml index 70369bcc4..23bafa1e5 100644 --- a/.github/workflows/update-readthedocs.yml +++ b/.github/workflows/update-readthedocs.yml @@ -11,17 +11,42 @@ on: branches: - main paths: - - 'docs/source/**' - - 'docs/resources/**' + - 'docs/**' + - '.github/workflows/update-readthedocs.yml' + pull_request: + branches: + - main + paths: + - 'docs/**' - '.github/workflows/update-readthedocs.yml' jobs: update-readthedocs: - runs-on: ubuntu-latest + runs-on: ubuntu-latest env: TOKEN: ${{ secrets.READTHEDOCS_TOKEN }} steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v5 + + - name: Sync with uv + run: uv sync --extra docs + + - name: Build HTML + run: | + cd docs + uv run make html + - name: Trigger ReadTheDocs build + if: github.event_name != 'pull_request' run: | if [ -z "$TOKEN" ]; then echo "READTHEDOCS_TOKEN is not set"