Skip to content

Commit

Permalink
[Doc,CI] Sanitize version (#762)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmoens authored Apr 25, 2024
1 parent fac63c3 commit 6d63bd4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ jobs:
PYOPENGL_PLATFORM=egl MUJOCO_GL=egl python3 -c """from tensordict import *"""
cd ..
# 9. Set sanitize version
if [[ ${{ github.event_name }} == push && (${{ github.ref_type }} == tag || (${{ github.ref_type }} == branch && ${{ github.ref_name }} == release/*)) ]]; then
echo '::group::Enable version string sanitization'
# This environment variable just has to exist and must not be empty. The actual value is arbitrary.
# See docs/source/conf.py for details
export TENSORDICT_SANITIZE_VERSION_STR_IN_DOCS=1
echo '::endgroup::'
fi
# 10. Build doc
cd ./docs
make docs
Expand Down
15 changes: 9 additions & 6 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = "main (" + str(tensordict.__version__) + " )"
# The full version, including alpha/beta/rc tags.
# TODO: verify this works as expected
release = "main"
# version: The short X.Y version.
# release: The full version, including alpha/beta/rc tags.
if os.environ.get("TENSORDICT_SANITIZE_VERSION_STR_IN_DOCS", None):
# Turn 1.11.0aHASH into 1.11 (major.minor only)
version = release = ".".join(tensordict.__version__.split(".")[:2])
html_title = " ".join((project, version, "documentation"))
else:
version = f"main ({tensordict.__version__})"
release = "main"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down

0 comments on commit 6d63bd4

Please sign in to comment.