From 0dda12ba7dda8da82058671db232107a3f3ebe72 Mon Sep 17 00:00:00 2001 From: Jaro Camphuijsen Date: Wed, 18 Feb 2026 15:17:06 +0100 Subject: [PATCH 1/2] Add workflows and dependencies to build and deploy versioned documentation with mike --- .../documentation-deploy-development.yml | 40 +++++++++++++++++++ .../documentation-deploy-release.yml | 34 ++++++++++++++++ .github/workflows/documentation-deploy.yml | 27 ------------- .gitignore | 2 + README.dev.md | 4 ++ mkdocs.yml | 4 ++ pyproject.toml | 1 + 7 files changed, 85 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/documentation-deploy-development.yml create mode 100644 .github/workflows/documentation-deploy-release.yml delete mode 100644 .github/workflows/documentation-deploy.yml diff --git a/.github/workflows/documentation-deploy-development.yml b/.github/workflows/documentation-deploy-development.yml new file mode 100644 index 0000000..c46364a --- /dev/null +++ b/.github/workflows/documentation-deploy-development.yml @@ -0,0 +1,40 @@ +name: Build/Publish Latest Develop Docs + +permissions: write-all + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + build-docs-and-deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.13 + + - name: Install dependencies + run: | + pip install ".[doc]" + - name: Setup Docs Deploy user + run: | + git config --global user.name "Docs Deploy" + git config --global user.email "docs.deploy@example.co.uk" + - name: Deploy mkdocs on GitHub Pages + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + TAG_NAME=${{ github.ref_name }} + MAJ_MIN_VERSION=${TAG_NAME%/*} + echo $MAJ_MIN_VERSION + mike deploy --push develop diff --git a/.github/workflows/documentation-deploy-release.yml b/.github/workflows/documentation-deploy-release.yml new file mode 100644 index 0000000..9c2c317 --- /dev/null +++ b/.github/workflows/documentation-deploy-release.yml @@ -0,0 +1,34 @@ +name: Build/Publish Latest Release Docs + +permissions: write-all + +on: + release: + types: [published] + +jobs: + build-docs-and-deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.13 + + - name: Install dependencies + run: | + pip install ".[doc]" + - name: Setup Docs Deploy user + run: | + git config --global user.name "Docs Deploy" + git config --global user.email "docs.deploy@example.co.uk" + - name: Deploy mkdocs on GitHub Pages + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + TAG_NAME=${{ github.event.release.tag_name }} + MAJ_MIN_VERSION=${TAG_NAME%.*} + mike deploy --push --update-aliases $MAJ_MIN_VERSION latest diff --git a/.github/workflows/documentation-deploy.yml b/.github/workflows/documentation-deploy.yml deleted file mode 100644 index 3b29336..0000000 --- a/.github/workflows/documentation-deploy.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: documentation-deploy - -permissions: write-all - -on: - release: - types: [published] - -jobs: - build-docs-and-deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: 3.9 - - - name: Install dependencies - run: | - pip install ".[doc]" - - name: Deploy mkdocs on GitHub Pages - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - mkdocs gh-deploy --force diff --git a/.gitignore b/.gitignore index 806f54c..6a3810c 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,8 @@ coverage.xml docs/_build docs/apidocs +site + # ide .idea .eclipse diff --git a/README.dev.md b/README.dev.md index 6aaba25..ccc3e80 100644 --- a/README.dev.md +++ b/README.dev.md @@ -114,6 +114,10 @@ mkdocs serve This will return a URL (e.g. `http://127.0.0.1:8000/mibiscreen/`) where the docs site can be viewed. +Note that this will only create the "non-versioned" documentation, which should be fine for testing changes to the docs. +The versioned documentation is created using the python utility called [mike](https://github.com/jimporter/mike?tab=readme-ov-file#mike) and its corresponding [mkdocs integration](https://squidfunk.github.io/mkdocs-material/setup/setting-up-versioning/). +In general it should not be necessary to test this, but if necessary, use [the mike documentation](https://github.com/jimporter/mike?tab=readme-ov-file#viewing-your-docs) to inspect locally. + ## Versioning Bumping the version across all files is done with [bump-my-version](https://github.com/callowayproject/bump-my-version), e.g. diff --git a/mkdocs.yml b/mkdocs.yml index 0aa66c9..497b217 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -103,3 +103,7 @@ extra: social: - icon: fontawesome/brands/github link: https://github.com/MiBiPreT/mibiscreen + version: + provider: mike + default: latest + alias: true \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index cd5de4f..7c48f3a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,6 +67,7 @@ doc = [ "mkdocstrings[python] ==0.27.0", "mdx-include >=1.4.1", "mkdocs-markdownextradata-plugin >=0.2.5", + "mike >=2.1.3", ] [project.urls] From 76ca2bb6f79a236c0f82251a1c3a7b51c426aa4e Mon Sep 17 00:00:00 2001 From: raar1 Date: Wed, 18 Feb 2026 18:57:01 +0100 Subject: [PATCH 2/2] Add dev documentation for replacing expired SONAR_TOKEN --- .linkspector.yml | 7 +++++++ README.dev.md | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 .linkspector.yml diff --git a/.linkspector.yml b/.linkspector.yml new file mode 100644 index 0000000..8062467 --- /dev/null +++ b/.linkspector.yml @@ -0,0 +1,7 @@ +dirs: + - ./ +useGitIgnore: true +excludedFiles: + - ./README.dev.md +ignorePatterns: + - pattern: "https://doi.org/.*" diff --git a/README.dev.md b/README.dev.md index ccc3e80..838f305 100644 --- a/README.dev.md +++ b/README.dev.md @@ -158,3 +158,20 @@ This will create the release on github and automatically trigger: 1. The `.github/workflows/publish.yml` workflow which will build the package and publish it on PyPI 1. The Zenodo-Github integration into making a snapshot of your repository and sticking a DOI on it and adding the new version to the main Zenodo entry for your software at [10.5281/zenodo.10878799](https://doi.org/10.5281/zenodo.10878799) + + +## Getting a new `SONAR_TOKEN` +If the Sonar pipeline does not run for 60 days, the `SONAR_TOKEN` expires. +You can see the original announcement [in this thread](https://community.sonarsource.com/t/removing-inactive-tokens-after-60-days/142451/6). + +The expiry happens silently, so any github action workflows using Sonar will appear to suddenly fail with cryptic errors such as `"ERROR Failed to query JRE metadata: . Please check the property sonar.token or the environment variable SONAR_TOKEN. "`. If you see this, it means you need to recreate the `SONAR_TOKEN` for this repository. You will need some admin privileges to carry out the following steps: + +1. Go to 'My Account' on the sonarcloud.io site after logging in (or try following this URL: ) +1. Click on the 'Security' tab () +1. Enter a token name in the field under "Generate Tokens" and click "Generate Token" +1. Copy the text for the generated token (you will not be able to see this text again) +1. Go to the "Actions secrets and variables" section of the `mibiscreen` repository on GitHub () +1. Edit the existing `SONAR_TOKEN` (or create it, if it does not exist). Paste in the token text you copied from sonarcloud earlier +1. Click "Update Secret" + +This should result in the newly created `SONAR_TOKEN` being used in any new github workflow runs. You may also choose to rerun some previously failed workflows (these should now succeed).