From ebbc1f0b0de89791d96045a1139664b6335315f5 Mon Sep 17 00:00:00 2001 From: mdtanker Date: Wed, 16 Jul 2025 13:49:30 +0200 Subject: [PATCH 01/20] switch from RTD to GitHub Pages --- .github/workflows/documentation.yml | 42 +++++++++++++++++++++++++++++ .pre-commit-config.yaml | 1 - .readthedocs.yaml | 18 ------------- 3 files changed, 42 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/documentation.yml delete mode 100644 .readthedocs.yaml diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 0000000..9974523 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,42 @@ +name: documentation + +on: [push, pull_request, workflow_dispatch] + +# This job installs dependencies, builds the html, and pushes it to gh-pages +jobs: + docs: + runs-on: ubuntu-latest + permissions: + contents: write + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} # only run one of these jobs at a time + defaults: + run: + shell: bash -l {0} + + steps: + # Checkout current git repository + - name: Checkout + uses: actions/checkout@v4 + + # Install dependencies + - name: Setup Mambaforge + uses: mamba-org/setup-micromamba@v2 + with: + environment-file: environment.yml + environment-name: samplepackagename + + # Build the documentation + - name: Build the documentation + run: uvx nox -s doc --non-interactive + + # Deploy the book's HTML to gh-pages branch + - name: GitHub Pages action + uses: peaceiris/actions-gh-pages@v4 + # Only publish if the main branch + if: ${{ github.ref == 'refs/heads/main' }} + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: _build/ + publish_branch: gh-pages + # force_orphan: true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 37b858f..007ff64 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -92,4 +92,3 @@ repos: hooks: - id: check-dependabot - id: check-github-workflows - - id: check-readthedocs diff --git a/.readthedocs.yaml b/.readthedocs.yaml deleted file mode 100644 index 6dc66a1..0000000 --- a/.readthedocs.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# Read the Docs configuration file -# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details - -version: 2 - -build: - os: ubuntu-22.04 - tools: - python: "mambaforge-22.9" - jobs: - install: - - pip install --no-deps . - -sphinx: - configuration: docs/conf.py - -conda: - environment: environment.yml From 0d9752140585b74e341ab3ee4204568d796f892b Mon Sep 17 00:00:00 2001 From: mdtanker Date: Wed, 16 Jul 2025 13:53:12 +0200 Subject: [PATCH 02/20] fix uvx in documentation action --- .github/workflows/documentation.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 9974523..d8c7d5e 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -20,11 +20,9 @@ jobs: uses: actions/checkout@v4 # Install dependencies - - name: Setup Mambaforge - uses: mamba-org/setup-micromamba@v2 + - uses: actions/setup-python@v5 with: - environment-file: environment.yml - environment-name: samplepackagename + python-version: "3.x" # Build the documentation - name: Build the documentation From a7d32337487b7a629240321ddf01030dc82d4cb8 Mon Sep 17 00:00:00 2001 From: mdtanker Date: Wed, 16 Jul 2025 13:56:25 +0200 Subject: [PATCH 03/20] add astral setup-uv to documentation action --- .github/workflows/documentation.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index d8c7d5e..72dbb71 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -19,11 +19,13 @@ jobs: - name: Checkout uses: actions/checkout@v4 - # Install dependencies + # setup python env - uses: actions/setup-python@v5 with: python-version: "3.x" + - uses: astral-sh/setup-uv@v6 + # Build the documentation - name: Build the documentation run: uvx nox -s doc --non-interactive From 3d8715899768e03ac2b2dc9c25af1e2860119c1a Mon Sep 17 00:00:00 2001 From: mdtanker Date: Wed, 16 Jul 2025 13:57:59 +0200 Subject: [PATCH 04/20] build API docs in action --- .github/workflows/documentation.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 72dbb71..8c7e1e7 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -26,9 +26,13 @@ jobs: - uses: astral-sh/setup-uv@v6 + # Make API docs + - name: Make API docs + run: uvx nox -s build_api_docs + # Build the documentation - name: Build the documentation - run: uvx nox -s doc --non-interactive + run: uvx nox -s docs --non-interactive # Deploy the book's HTML to gh-pages branch - name: GitHub Pages action From 005b126e6ad1341e6809292ba473c5471914a10f Mon Sep 17 00:00:00 2001 From: mdtanker Date: Wed, 16 Jul 2025 14:00:58 +0200 Subject: [PATCH 05/20] remove outdated packagename api file --- docs/api/packagename.rst | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 docs/api/packagename.rst diff --git a/docs/api/packagename.rst b/docs/api/packagename.rst deleted file mode 100644 index 894c628..0000000 --- a/docs/api/packagename.rst +++ /dev/null @@ -1,18 +0,0 @@ -samplepackagename package -=================== - -.. automodule:: samplepackagename - :members: - :show-inheritance: - :undoc-members: - -Submodules ----------- - -samplepackagename.module1 module --------------------------- - -.. automodule:: samplepackagename.module1 - :members: - :show-inheritance: - :undoc-members: From 28cf2c4ca2d1c0fd83d4ab1e851618ba24252722 Mon Sep 17 00:00:00 2001 From: mdtanker Date: Wed, 16 Jul 2025 14:02:08 +0200 Subject: [PATCH 06/20] remove docs/api folder --- docs/api/samplepackagename.rst | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 docs/api/samplepackagename.rst diff --git a/docs/api/samplepackagename.rst b/docs/api/samplepackagename.rst deleted file mode 100644 index 8f56933..0000000 --- a/docs/api/samplepackagename.rst +++ /dev/null @@ -1,18 +0,0 @@ -samplepackagename package -========================= - -.. automodule:: samplepackagename - :members: - :show-inheritance: - :undoc-members: - -Submodules ----------- - -samplepackagename.module1 module --------------------------------- - -.. automodule:: samplepackagename.module1 - :members: - :show-inheritance: - :undoc-members: From 5944e1d977011e37f6f0c309bf3151ebf556a28f Mon Sep 17 00:00:00 2001 From: mdtanker Date: Wed, 16 Jul 2025 14:04:45 +0200 Subject: [PATCH 07/20] fix nbgallery errors in docs --- docs/examples/index.md | 6 +++++- docs/how_to/index.md | 6 +++++- docs/tutorials/index.md | 7 ++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/examples/index.md b/docs/examples/index.md index 5ec8d89..6b2e0f8 100644 --- a/docs/examples/index.md +++ b/docs/examples/index.md @@ -1,7 +1,11 @@ # Examples + +notebook1 +notebook2 +notebook3 ``` +--> \ No newline at end of file diff --git a/docs/how_to/index.md b/docs/how_to/index.md index b41167f..37b78b5 100644 --- a/docs/how_to/index.md +++ b/docs/how_to/index.md @@ -1,7 +1,11 @@ # How-To Guides + +notebook1 +notebook2 +notebook3 ``` +--> diff --git a/docs/tutorials/index.md b/docs/tutorials/index.md index 674d9b9..79f346d 100644 --- a/docs/tutorials/index.md +++ b/docs/tutorials/index.md @@ -4,9 +4,14 @@ These tutorials are designed to introduce a new user to the software. They expect you to be familiar with Python and have the package [successfully installed](../install.md). You should follow these in order, then refer to the [how-to guides](../how_to/index.md) for more in-depth guides for specific features. + + +notebook1 +notebook2 +notebook3 ``` +--> \ No newline at end of file From 6b47220d341dae3bb3a9f234a136a7d60f46cbf6 Mon Sep 17 00:00:00 2001 From: mdtanker Date: Wed, 16 Jul 2025 14:06:30 +0200 Subject: [PATCH 08/20] style fixes --- docs/examples/index.md | 2 +- docs/tutorials/index.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/examples/index.md b/docs/examples/index.md index 6b2e0f8..cb830d3 100644 --- a/docs/examples/index.md +++ b/docs/examples/index.md @@ -8,4 +8,4 @@ notebook1 notebook2 notebook3 ``` ---> \ No newline at end of file +--> diff --git a/docs/tutorials/index.md b/docs/tutorials/index.md index 79f346d..1fa3282 100644 --- a/docs/tutorials/index.md +++ b/docs/tutorials/index.md @@ -14,4 +14,4 @@ notebook1 notebook2 notebook3 ``` ---> \ No newline at end of file +--> From a44439bd00866ddc0ac3fb72df1099fb7f652c26 Mon Sep 17 00:00:00 2001 From: mdtanker Date: Wed, 16 Jul 2025 14:09:47 +0200 Subject: [PATCH 09/20] install pandoc in action --- .github/workflows/documentation.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 8c7e1e7..70278e4 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -26,6 +26,9 @@ jobs: - uses: astral-sh/setup-uv@v6 + - id: install_pandoc + run: sudo apt-get install pandoc + # Make API docs - name: Make API docs run: uvx nox -s build_api_docs From 34a3ac9b18a26a36902e8502f5fc894015e0a22d Mon Sep 17 00:00:00 2001 From: mdtanker Date: Wed, 16 Jul 2025 14:13:16 +0200 Subject: [PATCH 10/20] temporarily remove publishing site only for main --- .github/workflows/documentation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 70278e4..e2a7f6f 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -41,7 +41,7 @@ jobs: - name: GitHub Pages action uses: peaceiris/actions-gh-pages@v4 # Only publish if the main branch - if: ${{ github.ref == 'refs/heads/main' }} + # if: ${{ github.ref == 'refs/heads/main' }} with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: _build/ From e1655d4325fc1d4af8334004bf4ab74cbc133e23 Mon Sep 17 00:00:00 2001 From: mdtanker Date: Wed, 16 Jul 2025 14:23:33 +0200 Subject: [PATCH 11/20] specify where docs are built in action --- .github/workflows/documentation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index e2a7f6f..5f5e6d6 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -44,6 +44,6 @@ jobs: # if: ${{ github.ref == 'refs/heads/main' }} with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: _build/ + publish_dir: docs/_build/html publish_branch: gh-pages # force_orphan: true From be3f14003f03c4f6412aad5d79552ce80537143e Mon Sep 17 00:00:00 2001 From: mdtanker Date: Wed, 16 Jul 2025 14:32:17 +0200 Subject: [PATCH 12/20] use sphinx githubpages extension --- docs/conf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index a77b1d8..d3dc729 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,6 +18,8 @@ "sphinx_copybutton", # "sphinx.ext.viewcode", "nbsphinx", + # githubpages just adds a .nojekyll file + "sphinx.ext.githubpages", ] source_suffix = [".rst", ".md"] From 4618943633a531c9a2a9c058e705a6745b91fff9 Mon Sep 17 00:00:00 2001 From: mdtanker Date: Wed, 16 Jul 2025 14:51:52 +0200 Subject: [PATCH 13/20] fix sphinx build location --- .github/workflows/documentation.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 5f5e6d6..9b14673 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -35,15 +35,15 @@ jobs: # Build the documentation - name: Build the documentation - run: uvx nox -s docs --non-interactive + run: uvx nox -s docs --non-interactive -- docs/_build/html # Deploy the book's HTML to gh-pages branch - name: GitHub Pages action uses: peaceiris/actions-gh-pages@v4 # Only publish if the main branch - # if: ${{ github.ref == 'refs/heads/main' }} + if: ${{ github.ref == 'refs/heads/main' }} with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: docs/_build/html publish_branch: gh-pages - # force_orphan: true + force_orphan: true From 48f20155ec74d58ee3178b7c0742e68ec478aeeb Mon Sep 17 00:00:00 2001 From: mdtanker Date: Wed, 16 Jul 2025 14:59:04 +0200 Subject: [PATCH 14/20] update readme --- README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 8fa6d21..c7e8429 100644 --- a/README.md +++ b/README.md @@ -138,13 +138,14 @@ Steps: - create a new folder : `staged-recipes/recipes/samplepackagename` - copy your `meta.yaml` file into this folder, remove the `meta.yaml` from wherever it was generated. - commit and push your changes to your fork, and in the main [repository](https://github.com/conda-forge/staged-recipes) open a PR. -13) Set up ReadTheDocs for the documentation website - - log into ReadTheDocs using your GitHub account. - - click `Add project` and ssearch for your repository. - - Chose your project name, ideally its the same as your package name, but it doesn't have to be. If it's different, update the badge below: `[rtd-link]: https://samplepackagename.readthedocs.io/en/latest/?badge=latest` - - Go to `settings` to update anything you'd like - - check `Build pull requests for this project`. - - for each commit to main, ReadTheDocs should automatically update the documentation website. Also, in PR's there should be a link to view the new docs to check them before merging the PR. +13) Set up GitHub Pages to host the documentation website + - this will only work for a public repository + - On GitHub, go to your repositories settings + - for `Source`, choose "Deplot from a branch" + - for `Branch`, choose "gh-pages" + - for `Select folder`, choose "root" + - optionally choose a custom URL and hit save + - for every push to `main` (from a PR), the site will be updated 14) Finalize - remove all the above instructions and raise any issues in this template's repository if you have any suggestion or found any errors in this template! - if you want, please submit a PR to this repository to add your package to this list at the top of this README to showcase it! @@ -153,7 +154,7 @@ Steps: Short description of your package. [![Actions Status][actions-badge]][actions-link] -[![Documentation Status][rtd-badge]][rtd-link] +[![Documentation Status][website-badge]][website-link] [![PyPI version][pypi-version]][pypi-link] [![Conda-Forge][conda-badge]][conda-link] @@ -173,8 +174,8 @@ Short description of your package. [pypi-link]: https://pypi.org/project/samplepackagename/ [pypi-platforms]: https://img.shields.io/pypi/pyversions/samplepackagename [pypi-version]: https://img.shields.io/pypi/v/samplepackagename -[rtd-badge]: https://readthedocs.org/projects/samplepackagename/badge/?version=latest -[rtd-link]: https://samplepackagename.readthedocs.io/en/latest/?badge=latest +[website-badge]: https://github.com/mdtanker/python_package_template/actions/workflows/pages/pages-build-deployment/badge.svg +[website-link]: https://mdtanker.github.io/python_package_template/ From 1fa387fa29a0adb8f30bb85564ec1fd249d5debc Mon Sep 17 00:00:00 2001 From: mdtanker Date: Wed, 16 Jul 2025 15:15:24 +0200 Subject: [PATCH 15/20] enable preview of site in PR's --- .github/workflows/documentation.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 9b14673..a35c770 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -37,7 +37,7 @@ jobs: - name: Build the documentation run: uvx nox -s docs --non-interactive -- docs/_build/html - # Deploy the book's HTML to gh-pages branch + # Deploy the HTML to gh-pages branch - name: GitHub Pages action uses: peaceiris/actions-gh-pages@v4 # Only publish if the main branch @@ -47,3 +47,15 @@ jobs: publish_dir: docs/_build/html publish_branch: gh-pages force_orphan: true + # keep_files is to prevent PR preview files from being overwritten. + # If we need to overwrite such files, trigger this workflow manually. + keep_files: ${{ github.event_name != 'workflow_dispatch' }} + + # Deploy the HTML to PR preview + - name: Deploy PR preview + # Only run this job if the PR was created from a branch because this job will + # fail for branches from forks. + if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository + uses: rossjrw/pr-preview-action@v1 + with: + source-dir: docs/_build/html From 26c0c30b16ca4bf9d28ce974166c0b79ac591b15 Mon Sep 17 00:00:00 2001 From: mdtanker Date: Wed, 16 Jul 2025 15:17:05 +0200 Subject: [PATCH 16/20] fixing PR preview --- .github/workflows/documentation.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index a35c770..5bd525c 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -41,7 +41,9 @@ jobs: - name: GitHub Pages action uses: peaceiris/actions-gh-pages@v4 # Only publish if the main branch - if: ${{ github.ref == 'refs/heads/main' }} + if: + github.event_name == 'push' || github.event_name == + 'workflow_dispatch' with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: docs/_build/html @@ -55,7 +57,9 @@ jobs: - name: Deploy PR preview # Only run this job if the PR was created from a branch because this job will # fail for branches from forks. - if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository + if: + github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name == github.repository uses: rossjrw/pr-preview-action@v1 with: source-dir: docs/_build/html From 0dfeb5de6ece9da4c2fa85a6bd2085358819a09b Mon Sep 17 00:00:00 2001 From: mdtanker Date: Wed, 16 Jul 2025 15:30:57 +0200 Subject: [PATCH 17/20] seperate deploy from preview actions --- .github/workflows/docs_preview.yml | 50 +++++++++++++++++++++++++++++ .github/workflows/documentation.yml | 20 ++---------- 2 files changed, 52 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/docs_preview.yml diff --git a/.github/workflows/docs_preview.yml b/.github/workflows/docs_preview.yml new file mode 100644 index 0000000..6171b7e --- /dev/null +++ b/.github/workflows/docs_preview.yml @@ -0,0 +1,50 @@ +name: Docs Preview + +permissions: + pull-requests: write + +on: + pull_request: + types: + - opened + - synchronize + - reopened + - edited + - closed + workflow_dispatch: + +concurrency: preview-${{github.ref}} + +jobs: + deploy-preview: + runs-on: ubuntu-latest + steps: + # Checkout current git repository + - name: Checkout + uses: actions/checkout@v4 + + # setup python env + - uses: actions/setup-python@v5 + with: + python-version: "3.x" + + - uses: astral-sh/setup-uv@v6 + + - id: install_pandoc + run: sudo apt-get install pandoc + + # Make API docs + - name: Make API docs + run: uvx nox -s build_api_docs + + # Build the documentation + - name: Build the documentation + run: uvx nox -s docs --non-interactive -- docs/_build/html + + # Deploy the preview of the docs + - name: Deploy Preview + uses: rossjrw/pr-preview-action@v1 + with: + source-dir: docs/_build/html + preview-branch: gh-pages + # custom-url: diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 5bd525c..68b7270 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -19,7 +19,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 - # setup python env + # setup python env - uses: actions/setup-python@v5 with: python-version: "3.x" @@ -41,25 +41,9 @@ jobs: - name: GitHub Pages action uses: peaceiris/actions-gh-pages@v4 # Only publish if the main branch - if: - github.event_name == 'push' || github.event_name == - 'workflow_dispatch' + if: github.ref == 'refs/heads/main' with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: docs/_build/html publish_branch: gh-pages force_orphan: true - # keep_files is to prevent PR preview files from being overwritten. - # If we need to overwrite such files, trigger this workflow manually. - keep_files: ${{ github.event_name != 'workflow_dispatch' }} - - # Deploy the HTML to PR preview - - name: Deploy PR preview - # Only run this job if the PR was created from a branch because this job will - # fail for branches from forks. - if: - github.event_name == 'pull_request' && - github.event.pull_request.head.repo.full_name == github.repository - uses: rossjrw/pr-preview-action@v1 - with: - source-dir: docs/_build/html From 7c2e5aebebb8cf2e745072f4ea10f158856cffbb Mon Sep 17 00:00:00 2001 From: mdtanker Date: Wed, 16 Jul 2025 15:38:55 +0200 Subject: [PATCH 18/20] add bash to deplot docs action --- .github/workflows/docs_preview.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docs_preview.yml b/.github/workflows/docs_preview.yml index 6171b7e..33b329f 100644 --- a/.github/workflows/docs_preview.yml +++ b/.github/workflows/docs_preview.yml @@ -1,8 +1,5 @@ name: Docs Preview -permissions: - pull-requests: write - on: pull_request: types: @@ -13,11 +10,16 @@ on: - closed workflow_dispatch: -concurrency: preview-${{github.ref}} - jobs: deploy-preview: runs-on: ubuntu-latest + permissions: + contents: write + concurrency: preview-${{github.ref}} + defaults: + run: + shell: bash -l {0} + steps: # Checkout current git repository - name: Checkout From f657c8f5af9ba37cd284a2026ba68c17659d84cc Mon Sep 17 00:00:00 2001 From: mdtanker Date: Wed, 16 Jul 2025 15:46:19 +0200 Subject: [PATCH 19/20] fix docs preview action --- .github/workflows/docs_preview.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs_preview.yml b/.github/workflows/docs_preview.yml index 33b329f..26476d3 100644 --- a/.github/workflows/docs_preview.yml +++ b/.github/workflows/docs_preview.yml @@ -10,12 +10,16 @@ on: - closed workflow_dispatch: +concurrency: preview-${{github.ref}} + jobs: - deploy-preview: + preview: runs-on: ubuntu-latest + # only run if from the same repository, not a fork + if: github.event.pull_request.head.repo.full_name == github.repository permissions: contents: write - concurrency: preview-${{github.ref}} + pull-requests: write defaults: run: shell: bash -l {0} @@ -50,3 +54,7 @@ jobs: source-dir: docs/_build/html preview-branch: gh-pages # custom-url: + umbrella-dir: pr-preview + action: auto + deploy-repository: ${{ github.repository }} + token: ${{ secrets.GITHUB_TOKEN }} From 1fbf46c3e3f74ed98b542c4bda680d3609388cbf Mon Sep 17 00:00:00 2001 From: mdtanker Date: Wed, 16 Jul 2025 15:52:56 +0200 Subject: [PATCH 20/20] fix docs preview action --- .github/workflows/docs_preview.yml | 5 +++++ .github/workflows/documentation.yml | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs_preview.yml b/.github/workflows/docs_preview.yml index 26476d3..6825462 100644 --- a/.github/workflows/docs_preview.yml +++ b/.github/workflows/docs_preview.yml @@ -8,6 +8,8 @@ on: - reopened - edited - closed + branches: + - "main" workflow_dispatch: concurrency: preview-${{github.ref}} @@ -31,6 +33,7 @@ jobs: # setup python env - uses: actions/setup-python@v5 + if: github.event.action != 'closed' # Skip the build if the PR has been closed; just run the clean up steps with: python-version: "3.x" @@ -41,10 +44,12 @@ jobs: # Make API docs - name: Make API docs + if: github.event.action != 'closed' run: uvx nox -s build_api_docs # Build the documentation - name: Build the documentation + if: github.event.action != 'closed' run: uvx nox -s docs --non-interactive -- docs/_build/html # Deploy the preview of the docs diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 68b7270..13cb06d 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -1,6 +1,10 @@ name: documentation -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - main + workflow_dispatch: # This job installs dependencies, builds the html, and pushes it to gh-pages jobs: @@ -40,8 +44,6 @@ jobs: # Deploy the HTML to gh-pages branch - name: GitHub Pages action uses: peaceiris/actions-gh-pages@v4 - # Only publish if the main branch - if: github.ref == 'refs/heads/main' with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: docs/_build/html