Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
8abd429
Add files via upload
dimtsap Jul 15, 2025
1852f86
Create documentation.yaml
dimtsap Jul 15, 2025
c96b44e
Update documentation.yaml
dimtsap Jul 15, 2025
cb3a656
Update documentation.yaml
dimtsap Jul 15, 2025
b472920
Update documentation.yaml
dimtsap Jul 15, 2025
420863f
Update documentation.yaml
dimtsap Jul 15, 2025
a9a3e37
Update documentation.yaml
dimtsap Jul 15, 2025
0b00705
Update documentation.yaml
dimtsap Jul 15, 2025
dda7c39
Update documentation.yaml
dimtsap Jul 15, 2025
a8e3b26
Update documentation.yaml
dimtsap Jul 15, 2025
ba54ae8
Update documentation.yaml
dimtsap Jul 15, 2025
384c1aa
Update conf.py
dimtsap Jul 15, 2025
f060edd
Moves docs/requirements to pyproject.toml
dimtsap Jul 21, 2025
c0097ab
Update documentation.yaml
dimtsap Jul 22, 2025
f9a35ff
Update documentation.yaml
dimtsap Jul 22, 2025
050ed3f
Update documentation.yaml
dimtsap Jul 22, 2025
98072e0
Update documentation.yaml
dimtsap Jul 22, 2025
bd83c9a
Update documentation.yaml
dimtsap Jul 22, 2025
10c8075
Create update_version_json.py
dimtsap Jul 22, 2025
1809a3a
Update documentation.yaml
dimtsap Jul 22, 2025
a9dd334
Update documentation.yaml
dimtsap Jul 22, 2025
284c81b
Update documentation.yaml
dimtsap Jul 22, 2025
0d6d8c1
Update update_version_json.py
dimtsap Jul 22, 2025
1b421dd
Update documentation.yaml
dimtsap Jul 22, 2025
245f067
Update documentation.yaml
dimtsap Jul 22, 2025
1757175
Update documentation.yaml
dimtsap Jul 22, 2025
8abca4c
Update documentation.yaml
dimtsap Jul 22, 2025
a312826
Update update_version_json.py
dimtsap Jul 22, 2025
4e57fe5
Update update_version_json.py
dimtsap Jul 22, 2025
fdc0256
Update update_version_json.py
dimtsap Jul 22, 2025
04595b9
Updates version.json file
dimtsap Jul 22, 2025
57c8b70
Update documentation.yaml
dimtsap Jul 22, 2025
85852bd
Update documentation.yaml
dimtsap Jul 22, 2025
a18b25a
Update update_version_json.py
dimtsap Jul 22, 2025
02facb5
Sorts gh-pages folder chronologically
dimtsap Jul 22, 2025
fabc65d
Sorts gh-pages folders by parsing version number
dimtsap Jul 22, 2025
989954f
Removes pandoc version
dimtsap Aug 12, 2025
b4805da
Update Makefile
dimtsap Aug 12, 2025
d32b2b4
Update documentation.yaml
dimtsap Aug 14, 2025
ae434f9
Deletes old contents of versioned and latest folders
dimtsap Aug 14, 2025
0f79ca1
Update documentation.yaml
dimtsap Aug 26, 2025
71cb8c6
Create faqs.rst
dimtsap Sep 5, 2025
9bfd946
Update index.rst
dimtsap Sep 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# .github/workflows/docs.yml

name: Build & Deploy Sphinx Docs

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
docs:
runs-on: ubuntu-latest
env:
PANDOC_VERSION: ${{ vars.PANDOC_VERSION }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Get tag name
id: get_tag
run: echo "tag=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT

- name: Show tag
run: |
echo "Tag: ${{ steps.get_tag.outputs.tag }}"

- name: Extract version without "v"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to pick out just major version strings like "v0.1", "v0.2" instead of v0.1.2, v0.2.1 from TAGs. I can imagine we could have a python script to filter them out and send to $GITHUB_OUTPUT variable but unsure if there is a better way. If we can handle this up in the front, I hope that the other steps should overwrite to same major release doc site folder when the minor release gets pushed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can define internally your version strategy for the documentation that would be really helpful. The initial issue stated that the documentation should be triggered on new releases, this is why I used the current approach. Please let me know which versions you want to display and how the gh-pages branch should behave (folder structure, file replacement etc) to adjust it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dimtsap Thank you for continuing to work on this! :) I think your current PR folder structure looks good; it's just that we want to track up to the minor releases for the documentation site, such as "v0.1", "v0.2", ..., "v0.#". I hope there is a way to overwrite the minor release folder whenever a patch tag is pushed.

I was thinking more along the following lines, but I'm unsure if it sounds possible to make it work:

  1. A push happens for v* tags.
  2. The Show tag step runs as it is.
  3. The Set up Python step runs to set up the Python script executable environment.
  4. A Python script extracts the version name up to the minor digit at a new Extract version without "v" step.
  5. The rest of the steps use the minor digit folder name. (Maybe delete and write a new one?)

Is it sounded possible?

id: version
run: |
RAW_TAG="${GITHUB_REF_NAME}"
VERSION="${RAW_TAG#v}"
VERSION="${VERSION%.*}"
echo "clean_version=$VERSION" >> $GITHUB_OUTPUT
echo $clean_version

- name: Update conf.py release version
run: |
sed -i "s/^release = .*/release = '${{ steps.version.outputs.clean_version }}'/" docs/source/conf.py
head -n 20 docs/source/conf.py

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install Poetry
run: |
pip install poetry

- name: Download and install Pandoc
run: |
FILE="pandoc-${PANDOC_VERSION}-1-amd64.deb"
URL="https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/${FILE}"

echo "Downloading $FILE..."
curl -L -o pandoc.deb "$URL"

echo "Installing Pandoc..."
sudo dpkg -i pandoc.deb

- name: Verify Pandoc version
run: pandoc --version

- name: Install dependencies
run: |
poetry lock
poetry install --with docs
eval $(poetry env activate)

- name: Checkout gh-pages branch to get versions.json
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages

- name: Update version.json
run: |
VERSION=${{ steps.version.outputs.clean_version }}
python .github/workflows/update_version_json.py "$VERSION" "gh-pages"
cat gh-pages/versions.json
mkdir docsVersion
cp gh-pages/versions.json docsVersion/versions.json

- name: Build Sphinx docs
run: |
eval $(poetry env activate)
make -C docs clean
make -C docs html

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docsVersion
keep_files: true

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build/html
destination_dir: v${{ steps.version.outputs.clean_version }}
keep_files: true

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build/html
destination_dir: latest
keep_files: true
44 changes: 44 additions & 0 deletions .github/workflows/update_version_json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import json
import os
import sys
from pathlib import Path

def rebuild_version_json(current_version, gh_pages_path, site_url="https://cvs-health.github.io/uqlm"):
version_json_path = Path(gh_pages_path) / "versions.json"
entries = []

# List only v* folders, ignore 'latest'
folders = [
p for p in Path(gh_pages_path).iterdir()
if p.is_dir() and p.name.startswith("v")
]

folders = sorted(folders, key=lambda f: tuple([ int(x) for x in f.name[1:].split('.')]), reverse=True)

entries.append({
"name": f"v{current_version} (latest)",
"version": current_version,
"url": f"{site_url}/latest/"
})
for folder in folders:
version = folder.name[1:] # strip leading 'v'
entry = {
"name": f"v{version}",
"version": version,
"url": f"{site_url}/v{version}/"
}

entries.append(entry)

# Save version.json
with open(version_json_path, "w") as f:
json.dump(entries, f, indent=4)

if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: python rebuild_version_json.py <current_version> <gh_pages_path>")
sys.exit(1)

current_version = sys.argv[1]
gh_pages_path = sys.argv[2]
rebuild_version_json(current_version, gh_pages_path)
36 changes: 36 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

# Get the parent dir name which is this docs' version
VERSION := $(notdir $(CURDIR))

github:
@rm -rf build/html build/doctrees source/_autosummary/*.rst
@cp -rf ../../assets/* source/_static/
@cp -rf ../../examples/* source/_notebooks/examples/
@make html
@mkdir -p ../../docs/$(VERSION)
@rm -rf ../../docs/$(VERSION)/*
@cp -a build/html/. ../../docs/$(VERSION)/
@cp ../versions.json ../../docs/versions.json

local:
@python -m http.server --directory ../../docs/$(VERSION)/ 8080
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
Loading