Skip to content

Commit

Permalink
docs: Move multi-site build configuration to helper repo
Browse files Browse the repository at this point in the history
  • Loading branch information
dbhart committed Nov 20, 2024
1 parent 3812b02 commit e39e194
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 64 deletions.
34 changes: 25 additions & 9 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
build:
name: Build the documentation with Sphinx
runs-on: ubuntu-latest
environment:
name: github-pages
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
Expand Down Expand Up @@ -61,29 +63,43 @@ jobs:
python -m pip install --upgrade pip
python -m pip install -r requirements.txt -r docs/requirements.txt
- name: Checkout docs root
run:
git clone https://github.com/sandialabs/sansmic-ci.git
python -m pip install -r sansmic-ci/docs/requirements.txt

- name: Build documentation
run: |
python -m pip install -e .[formats]
git config set versionsort.suffix -rc
export SANSMIC_SPHINX_VERSION=${{ github.ref_name }}@`git rev-parse --short HEAD`
python build_docs.py
export SANSMIC_SPHINX_VERSION=dev
python sansmic-ci/build_switcher.py
export SANSMIC_STABLE_VERSION=`cat stable.txt`
mkdir sansmic-ci/docs/$SANSMIC_STABLE_VERSION
touch sansmic-ci/docs/$SANSMIC_STABLE_VERSION/userman.rst
touch sansmic-ci/docs/$SANSMIC_STABLE_VERSION/refman.rst
cat sansmic-ci/docs/index.tpl | sed s/BUILD_SCRIPT_REPLACE/$SANSMIC_STABLE_VERSION/g > sansmic-ci/docs/index.rst
sphinx-build -b html -d doctrees/root/ sansmic-ci/docs/ html/
mkdir docs/_build
mkdir docs/_build/doxyxml
sphinx-build -b html docs/ out/
git clone https://github.com/sandialabs/sansmic-docs.git release-docs
mkdir html/
sphinx-build -b html -d doctrees/latest docs/ html/latest
for TAG in `git tag --list "v*.*.*" --sort=-version:refname`
do
pushd release-docs
git checkout $TAG
cp -rf html ../out/$TAG
popd
rm -rf docs
git checkout -f $TAG
export SANSMIC_SPHINX_VERSION=$TAG
cp -f sansmic-ci/docs/_static/* docs/_static/
cp -f sansmic-ci/docs/conf.py docs/conf.py
sphinx-build -q -b html -d doctrees/$TAG docs html/$TAG
done
- name: Upload artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
if: success() || failure()
with:
path: 'out/'
path: 'html/'

deploy:
name: Deploy documentation to GitHub Pages
Expand Down
57 changes: 2 additions & 55 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
project = "sansmic"
copyright = "2024 National Technology and Engineering Solutions of Sandia, LLC. Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains certain rights in this software."
author = "See AUTHORS.md"
version = os.environ.get("SANSMIC_SPHINX_VERSION", sansmic.__version__)
release = version
version = sansmic.__version__

# -- Extensions to load -------------------------------------------------------
extensions = [
Expand Down Expand Up @@ -212,6 +211,7 @@
# -- Options for HTML output -------------------------------------------------
html_theme = "pydata_sphinx_theme"
html_static_path = ["_static"]
html_title = "Sansmic"
html_js_files = [
"pypi-icon.js",
]
Expand Down Expand Up @@ -241,65 +241,12 @@
"use_edit_page_button": False,
"primary_sidebar_end": ["indices.html"],
"show_toc_level": 2,
"switcher": {
"json_url": "https://sandialabs.github.io/sansmic/_static/switcher.json",
"version_match": "v" + version
if len(version) > 0 and version[0].isdigit()
else version,
},
# "secondary_sidebar_items": ["page-toc"], #["page-toc", "edit-this-page", "sourcelink"],
"navbar_start": [
"navbar-logo",
"version-switcher",
],
"navbar_end": [
"theme-switcher",
"navbar-icon-links",
],
"analytics": {"google_analytics_id": "G-23TNKN36XM"},
}


# -- Options for LaTeX output -------------------------------------------------
latex_engine = "xelatex"
latex_use_xindy = False
latex_documents = [
("userman", "sansmic.tex", "User Guide for sansmic", "David Hart", "manual"),
]
latex_toplevel_sectioning = "chapter"
latex_domain_indices = False
latex_elements = {
"papersize": r"letterpaper",
"pointsize": r"10pt",
"passoptionstopackages": r"""
\PassOptionsToPackage{svgnames}{xcolor}
""",
"fontpkg": r"""
\usepackage{nimbussans}
\usepackage[nosf,nott]{kpfonts}
\usepackage[scaled=0.85]{sourcecodepro}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
""",
"preamble": r"""
\usepackage[titles]{tocloft}
\usepackage[
range-units=single,
per-mode=symbol,
group-digits=decimal,
group-minimum-digits=3,
group-separator={,},
range-phrase={\,--\,},
quotient-mode=fraction,
]{siunitx}\cftsetpnumwidth {1.25cm}
\cftsetrmarg{1.5cm}
\setlength{\cftchapnumwidth}{0.75cm}
\setlength{\cftsecindent}{\cftchapnumwidth}
\setlength{\cftsecnumwidth}{1.25cm}
\renewcommand\sphinxcrossref[1]{#1}
\renewcommand\sphinxtermref[1]{#1}
""",
"sphinxsetup": "TitleColor=DarkGoldenrod",
"fncychap": r"\usepackage[Bjornstrup]{fncychap}",
"printindex": r"\footnotesize\raggedright\printindex",
}

0 comments on commit e39e194

Please sign in to comment.