Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
47 changes: 40 additions & 7 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- devel-2.0
- master
workflow_dispatch:

permissions:
Expand All @@ -23,6 +24,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v6

- name: Define documentation versions
run: |
{
echo 'BLEND_DOC_VERSIONS<<EOF'
echo '[["devel-2.0","https://bioye97.github.io/blend/"],["2.0.0","https://bioye97.github.io/blend/2.0.0/"]]'
echo 'EOF'
} >> "${GITHUB_ENV}"

- name: Set up Python
uses: actions/setup-python@v6
with:
Expand All @@ -42,30 +51,54 @@ jobs:
texlive-latex-extra \
texlive-latex-recommended

- name: Configure CMake
- name: Configure development documentation
run: |
cmake -S . -B build \
cmake -S . -B build-devel \
-DBLEND_BUILD_DOCS=ON \
-DBLEND_BUILD_EXAMPLES=OFF \
-DBLEND_BUILD_TESTS=OFF \
-DSPHINX_BUILD_EXECUTABLE="$(command -v sphinx-build)"

- name: Build HTML and PDF documentation
run: cmake --build build --target docs
- name: Build development documentation
env:
BLEND_DOC_CURRENT_VERSION: devel-2.0
BLEND_DOC_GITHUB_VERSION: devel-2.0
run: cmake --build build-devel --target docs

- name: Configure 2.0.0 documentation
run: |
cmake -S . -B build-2.0.0 \
-DBLEND_BUILD_DOCS=ON \
-DBLEND_BUILD_EXAMPLES=OFF \
-DBLEND_BUILD_TESTS=OFF \
-DSPHINX_BUILD_EXECUTABLE="$(command -v sphinx-build)"

- name: Build 2.0.0 documentation
env:
BLEND_DOC_CURRENT_VERSION: 2.0.0
BLEND_DOC_GITHUB_VERSION: v2.0.0
run: cmake --build build-2.0.0 --target docs

- name: Assemble documentation site
run: |
cmake -E make_directory build/site
cmake -E copy_directory build-devel/doc/html build/site
cmake -E make_directory build/site/2.0.0
cmake -E copy_directory build-2.0.0/doc/html build/site/2.0.0

- name: Check documentation links
run: python .github/scripts/check_docs_links.py build/doc/html
run: python .github/scripts/check_docs_links.py build/site

- name: Disable Jekyll processing
run: touch build/doc/html/.nojekyll
run: touch build/site/.nojekyll

- name: Configure GitHub Pages
uses: actions/configure-pages@v6

- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v5
with:
path: build/doc/html
path: build/site

deploy:
name: Deploy documentation
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
[![CI](https://github.com/Bioye97/blend/actions/workflows/ci.yml/badge.svg)](https://github.com/Bioye97/blend/actions/workflows/ci.yml)
[![Documentation](https://github.com/Bioye97/blend/actions/workflows/pages.yml/badge.svg)](https://github.com/Bioye97/blend/actions/workflows/pages.yml)
[![Documentation](https://img.shields.io/badge/docs-latest-green.svg)](https://bioye97.github.io/blend/)
[![GitHub release](https://img.shields.io/github/v/release/Bioye97/blend)](https://github.com/Bioye97/blend/releases)
[![License](https://img.shields.io/github/license/Bioye97/blend)](https://github.com/Bioye97/blend)
[![GitHub release](https://img.shields.io/github/v/tag/Bioye97/blend?label=release&sort=semver)](https://github.com/Bioye97/blend/releases/tag/v2.0.0)
[![License](https://img.shields.io/badge/license-LGPL--3.0-blue.svg)](LICENSE)

## What is BLEND?

Expand Down
33 changes: 28 additions & 5 deletions doc/rst/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import importlib.util
import json
import os
from pathlib import Path

Expand Down Expand Up @@ -35,16 +36,38 @@
"navigation_depth": 4,
"style_external_links": True,
}


def _blend_versions():
default_versions = [
("devel-2.0", "https://bioye97.github.io/blend/"),
("2.0.0", "https://bioye97.github.io/blend/2.0.0/"),
]
raw_versions = os.environ.get("BLEND_DOC_VERSIONS")
if not raw_versions:
return default_versions

try:
versions = json.loads(raw_versions)
except json.JSONDecodeError as exc:
raise RuntimeError("BLEND_DOC_VERSIONS must be JSON") from exc

parsed_versions = []
for item in versions:
if not isinstance(item, list) or len(item) != 2:
raise RuntimeError("BLEND_DOC_VERSIONS entries must be [label, url] pairs")
parsed_versions.append((str(item[0]), str(item[1])))
return parsed_versions


html_context = {
"display_github": True,
"github_user": "Bioye97",
"github_repo": "blend",
"github_version": "devel-2.0",
"github_version": os.environ.get("BLEND_DOC_GITHUB_VERSION", "devel-2.0"),
"conf_py_path": "/doc/rst/source/",
"blend_current_version": "devel-2.0",
"blend_versions": [
("devel-2.0", "https://bioye97.github.io/blend/"),
],
"blend_current_version": os.environ.get("BLEND_DOC_CURRENT_VERSION", "devel-2.0"),
"blend_versions": _blend_versions(),
}

latex_documents = [
Expand Down