diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 8bc6c18..38d5211 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -64,12 +64,27 @@ jobs: - name: Build documentation run: | python -m pip install -e .[formats] - sphinx-build -b html docs/ docs/_build/html + git config set versionsort.suffix -rc + python build_docs.py + mkdir docs/_build + mkdir docs/_build/doxyxml + sphinx-build -b html docs/ out/ + for TAG in `git tag --list --sort=-version:refname` + do + python -m pip uninstall -y sansmic + rm -rf docs/_build/doxyxml docs/apidocs/* + export SANSMIC_SPHINX_VERSION=$TAG + export VERSION_INFO=$TAG + mkdir docs/_build/doxyxml + git checkout $TAG + python -m pip install --no-deps -e . + sphinx-build -b html docs/ out/releases/$TAG + done - name: Upload artifact uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 with: - path: 'docs/_build/html' + path: 'out/' deploy: name: Deploy documentation to GitHub Pages diff --git a/build_docs.py b/build_docs.py index f030790..b47aef6 100644 --- a/build_docs.py +++ b/build_docs.py @@ -11,7 +11,7 @@ my_env = os.environ.copy() git_tag = subprocess.run( - " ".join(["git", "tag", "--list", "v*.*.*", "--sort=version:refname"]), + " ".join(["git", "tag", "--list", "v*.*.*", "--sort=-version:refname"]), capture_output=True, text=True, shell=True, @@ -20,7 +20,7 @@ tags = git_tag.stdout.splitlines() versions = [ { - "name": "main branch", + "name": "stable", "version": "main", "url": "https://sandialabs.github.io/sansmic/", "preferred": False, @@ -39,34 +39,34 @@ dict( name=tag, version=tag, - url="https://sandialabs.github.io/sansmic/" + tag + "/", + url="https://sandialabs.github.io/sansmic/releases/" + tag + "/", preferred=latest, ) ) with open( - os.path.abspath(os.path.join(".", "pages", "_static", "switcher.json")), + os.path.abspath(os.path.join(".", "docs", "_static", "switcher.json")), "w", ) as fswitch: json.dump(versions, fswitch) -for tag in tags: - os.environ["VERSION_INFO"] = repr(tag) - my_env["SANSMIC_SPHINX_VERSION"] = tag - files = glob.glob("./docs/apidocs/*.rst") - for f in files: - os.remove(f) - subprocess.run("git checkout " + tag, shell=True) - subprocess.run( - " ".join( - [ - "sphinx-build", - "-b", - "html", - "docs/", - "pages/" + tag, - ] - ), - shell=True, - env=my_env, - ) +# for tag in tags: +# os.environ["VERSION_INFO"] = repr(tag) +# my_env["SANSMIC_SPHINX_VERSION"] = tag +# files = glob.glob("./docs/apidocs/*.rst") +# for f in files: +# os.remove(f) +# subprocess.run("git checkout " + tag, shell=True) +# subprocess.run( +# " ".join( +# [ +# "sphinx-build", +# "-b", +# "html", +# "docs/", +# "out/v/" + tag, +# ] +# ), +# shell=True, +# env=my_env, +# ) diff --git a/docs/_static/pypi-icon.js b/docs/_static/pypi-icon.js new file mode 100644 index 0000000..bc64dd6 --- /dev/null +++ b/docs/_static/pypi-icon.js @@ -0,0 +1,16 @@ +/******************************************************************************* + * Set a custom icon for pypi as it's not available in the fa built-in brands + */ +FontAwesome.library.add( + (faListOldStyle = { + prefix: "fa-custom", + iconName: "pypi", + icon: [ + 17.313, // viewBox width + 19.807, // viewBox height + [], // ligature + "e001", // unicode codepoint - private use area + "m10.383 0.2-3.239 1.1769 3.1883 1.1614 3.239-1.1798zm-3.4152 1.2411-3.2362 1.1769 3.1855 1.1614 3.2369-1.1769zm6.7177 0.00281-3.2947 1.2009v3.8254l3.2947-1.1988zm-3.4145 1.2439-3.2926 1.1981v3.8254l0.17548-0.064132 3.1171-1.1347zm-6.6564 0.018325v3.8247l3.244 1.1805v-3.8254zm10.191 0.20931v2.3137l3.1777-1.1558zm3.2947 1.2425-3.2947 1.1988v3.8254l3.2947-1.1988zm-8.7058 0.45739c0.00929-1.931e-4 0.018327-2.977e-4 0.027485 0 0.25633 0.00851 0.4263 0.20713 0.42638 0.49826 1.953e-4 0.38532-0.29327 0.80469-0.65542 0.93662-0.36226 0.13215-0.65608-0.073306-0.65613-0.4588-6.28e-5 -0.38556 0.2938-0.80504 0.65613-0.93662 0.068422-0.024919 0.13655-0.038114 0.20156-0.039466zm5.2913 0.78369-3.2947 1.1988v3.8247l3.2947-1.1981zm-10.132 1.239-3.2362 1.1769 3.1883 1.1614 3.2362-1.1769zm6.7177 0.00213-3.2926 1.2016v3.8247l3.2926-1.2009zm-3.4124 1.2439-3.2947 1.1988v3.8254l3.2947-1.1988zm-6.6585 0.016195v3.8275l3.244 1.1805v-3.8254zm16.9 0.21143-3.2947 1.1988v3.8247l3.2947-1.1981zm-3.4145 1.2411-3.2926 1.2016v3.8247l3.2926-1.2009zm-3.4145 1.2411-3.2926 1.2016v3.8247l3.2926-1.2009zm-3.4124 1.2432-3.2947 1.1988v3.8254l3.2947-1.1988zm-6.6585 0.019027v3.8247l3.244 1.1805v-3.8254zm13.485 1.4497-3.2947 1.1988v3.8247l3.2947-1.1981zm-3.4145 1.2411-3.2926 1.2016v3.8247l3.2926-1.2009zm2.4018 0.38127c0.0093-1.83e-4 0.01833-3.16e-4 0.02749 0 0.25633 0.0085 0.4263 0.20713 0.42638 0.49826 1.97e-4 0.38532-0.29327 0.80469-0.65542 0.93662-0.36188 0.1316-0.65525-0.07375-0.65542-0.4588-1.95e-4 -0.38532 0.29328-0.80469 0.65542-0.93662 0.06842-0.02494 0.13655-0.03819 0.20156-0.03947zm-5.8142 0.86403-3.244 1.1805v1.4201l3.244 1.1805z", // svg path (https://simpleicons.org/icons/pypi.svg) + ], + }), +); diff --git a/docs/conf.py b/docs/conf.py index 5f29a7a..3e9e6c5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -213,6 +213,9 @@ # -- Options for HTML output ------------------------------------------------- html_theme = "pydata_sphinx_theme" html_static_path = ["_static"] +html_js_files = [ + "pypi-icon.js", +] # html_sidebars = {"nomenclature": []} html_theme_options = { "logo": { @@ -226,9 +229,15 @@ "type": "fontawesome", # The type of image to be used "icon": "fa-brands fa-github", # Icon class (if "type": "fontawesome"), or path to local image (if "type": "local") }, + { + "name": "PyPI", # Label for this link + "url": "https://pypi.org/project/sansmic/", # required URL where the link will redirect + "type": "fontawesome", # The type of image to be used + "icon": "fa-custom fa-pypi", # Icon class (if "type": "fontawesome"), or path to local image (if "type": "local") + }, { "name": "Sandia National Laboratories", - "url": "https://sandia.gov", # required + "url": "https://www.sandia.gov", # required "type": "local", "icon": "_static/snl_logo.png", }, diff --git a/docs/index.rst b/docs/index.rst index cf057c4..ac70f22 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -39,6 +39,14 @@ exchanges, sales, remediations, and the original construction. Citing sansmic -------------- +If you use sansmic for a publication, please use the following citation: + +* Hart, David, & Zeitler, Todd, & Maurer, Hannah. (2024). *SANSMIC v.1.0*. [Computer software]. + https://github.com/sandialabs/sansmic. + https://doi.org/10.11578/dc.20240911.9 + +The list of current contributors is located in the ``AUTHORS.md`` file. + Indices and tables