From e985cfc9aa41bf357d6c6b8cb51e5a79e534470b Mon Sep 17 00:00:00 2001 From: Teresia Olsson Date: Wed, 9 Sep 2026 17:53:16 +0200 Subject: [PATCH] Add publishing built docs to gh-pages branch for binder. --- .github/workflows/deploy-pages.yml | 12 ++++++++++-- docs/source/conf.py | 4 +++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml index f64e05b..53dc653 100644 --- a/.github/workflows/deploy-pages.yml +++ b/.github/workflows/deploy-pages.yml @@ -7,7 +7,7 @@ on: workflow_dispatch: permissions: - contents: read + contents: write pages: write id-token: write @@ -35,6 +35,14 @@ jobs: - name: Build Sphinx docs run: ./build-docs.sh + - name: Publish built docs for Binder + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/build/html + publish_branch: gh-pages + force_orphan: true + - name: Configure GitHub Pages uses: actions/configure-pages@v6 @@ -53,4 +61,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v5 \ No newline at end of file + uses: actions/deploy-pages@v5 diff --git a/docs/source/conf.py b/docs/source/conf.py index 738c880..afcfceb 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -45,7 +45,9 @@ "binder": { "org": "python-accelerator-middle-layer", "repo": "documentation", - "branch": "main", + # Binder reads files from this branch. The docs build workflow publishes + # the generated documentation and notebooks here. + "branch": "gh-pages", "binderhub_url": "https://mybinder.org", "dependencies": ["../requirements.txt"], "notebooks_dir": "notebooks",