From 443d81ecb740ebe94a3498a44482713d92b5b870 Mon Sep 17 00:00:00 2001 From: Marc Romeyn Date: Thu, 18 Dec 2025 16:22:49 +0100 Subject: [PATCH] Adding docs badge Signed-off-by: Marc Romeyn --- .github/workflows/docs-deploy.yml | 35 ++++++++++++++++++------------- README.md | 1 + docs/conf.py | 11 +++++++--- docs/versions.json | 13 ++++++++++++ docs/versions1.json | 7 ------- 5 files changed, 42 insertions(+), 25 deletions(-) create mode 100644 docs/versions.json delete mode 100644 docs/versions1.json diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml index 5afc4c0a9..feff293d4 100644 --- a/.github/workflows/docs-deploy.yml +++ b/.github/workflows/docs-deploy.yml @@ -18,7 +18,7 @@ on: push: branches: - dev - # - main # Uncomment after dev is merged into main + - main paths: - "docs/**" - "pyproject.toml" @@ -46,8 +46,13 @@ jobs: enable-cache: true cache-dependency-glob: "pyproject.toml" - - name: Build documentation - run: uv run --group docs sphinx-build docs docs/_build/html -W --keep-going + - name: Build documentation (dev) + if: github.ref == 'refs/heads/dev' + run: DOCS_VERSION=dev uv run --group docs sphinx-build docs docs/_build/html -W --keep-going + + - name: Build documentation (stable) + if: github.ref == 'refs/heads/main' + run: DOCS_VERSION=stable uv run --group docs sphinx-build docs docs/_build/html -W --keep-going - name: Deploy docs (dev branch) if: github.ref == 'refs/heads/dev' @@ -62,15 +67,15 @@ jobs: user_email: "github-actions[bot]@users.noreply.github.com" commit_message: "docs: deploy dev from ${{ github.sha }}" - # Uncomment after dev is merged into main - # - name: Deploy docs (main branch) - # if: github.ref == 'refs/heads/main' - # uses: peaceiris/actions-gh-pages@v4 - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - # publish_dir: ./docs/_build/html - # publish_branch: gh-pages - # keep_files: true - # user_name: "github-actions[bot]" - # user_email: "github-actions[bot]@users.noreply.github.com" - # commit_message: "docs: deploy from ${{ github.sha }}" + - name: Deploy docs (main branch) + if: github.ref == 'refs/heads/main' + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs/_build/html + publish_branch: gh-pages + destination_dir: stable + keep_files: true + user_name: "github-actions[bot]" + user_email: "github-actions[bot]@users.noreply.github.com" + commit_message: "docs: deploy stable from ${{ github.sha }}" diff --git a/README.md b/README.md index 5878a67c8..aaa802653 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ Developer companion repo for working with NVIDIA's Nemotron models: inference, f [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/) [![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0) [![Contributions Welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg)](CONTRIBUTING.md) +[![Docs](https://img.shields.io/badge/docs-dev-76B900.svg)](https://nvidia-nemo.github.io/Nemotron/dev/) --- diff --git a/docs/conf.py b/docs/conf.py index 4b64d0216..ee3a295ea 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -20,10 +20,15 @@ # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information +import os + project = "Nemotron" copyright = "2025, NVIDIA Corporation" author = "NVIDIA Corporation" -release = "latest" + +# Version is set by CI via DOCS_VERSION env var (dev or stable) +# Defaults to "dev" for local builds +release = os.environ.get("DOCS_VERSION", "dev") # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration @@ -76,7 +81,7 @@ html_theme = "nvidia_sphinx_theme" html_theme_options = { "switcher": { - "json_url": "versions1.json", + "json_url": "https://nvidia-nemo.github.io/Nemotron/versions.json", "version_match": release, }, "icon_links": [ @@ -97,7 +102,7 @@ """ }, } -html_extra_path = ["project.json", "versions1.json"] +html_extra_path = ["project.json", "versions.json"] # Github links are now getting rate limited from the Github Actions linkcheck_ignore = [ diff --git a/docs/versions.json b/docs/versions.json new file mode 100644 index 000000000..0927df052 --- /dev/null +++ b/docs/versions.json @@ -0,0 +1,13 @@ +[ + { + "name": "dev", + "version": "dev", + "url": "https://nvidia-nemo.github.io/Nemotron/dev/" + }, + { + "name": "stable (main)", + "version": "stable", + "url": "https://nvidia-nemo.github.io/Nemotron/stable/", + "preferred": true + } +] diff --git a/docs/versions1.json b/docs/versions1.json deleted file mode 100644 index b8555f8e7..000000000 --- a/docs/versions1.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - { - "preferred": true, - "version": "latest", - "url": "https://docs.nvidia.com/nemotron/latest/" - } -]