From cf7a1be12ce58c07611ec98e29b9b8ed98ae9c5d Mon Sep 17 00:00:00 2001 From: Robin Date: Tue, 15 Oct 2024 12:24:00 +0200 Subject: [PATCH] Another attempt at deploying the docs properly --- .github/workflows/ci.yaml | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9c29d6b..a5323ff 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -94,6 +94,10 @@ jobs: docs: runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.10'] + steps: - name: Check out the repository uses: actions/checkout@v3 @@ -101,7 +105,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: ${{ matrix.python-version }} # Install Poetry - name: Install Poetry @@ -114,7 +118,7 @@ jobs: run: | poetry install --with dev - # Generate Sphinx Documentation with sphinx-apidoc + # Generate Sphinx Documentation - name: Generate API Documentation with Sphinx run: | poetry run sphinx-apidoc -o docs/source codes @@ -122,10 +126,27 @@ jobs: # Build HTML using Sphinx - name: Build HTML with Sphinx run: | - poetry run sphinx-build -b html docs/source docs/_build/html + poetry run sphinx-build -b html docs/source docs/_build - # Move files from docs/_build/html to docs/_build - - name: Move HTML files to _build + # Copy custom HTML files to a temporary folder + - name: Copy custom HTML files run: | - mv docs/_build/html/* docs/_build/ - rm -rf docs/_build/html + cp -r docs/custom_html/ site-root/ + + # Deploy both custom HTML files and Sphinx API docs to GitHub Pages + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: site-root + destination_dir: / + publish_branch: gh-pages + + # Deploy Sphinx API documentation to a subfolder on gh-pages + - name: Deploy Sphinx API docs to /api-docs + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/_build/html + destination_dir: api-docs + publish_branch: gh-pages