File tree Expand file tree Collapse file tree 2 files changed +21
-9
lines changed Expand file tree Collapse file tree 2 files changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -73,15 +73,24 @@ jobs:
7373
7474 # 8. Install requirements
7575 python3 -m pip install -r docs/requirements.txt --quiet --root-user-action=ignore
76-
77- # 9. Test torchrl installation
76+
77+ # 9. Set sanitize version
78+ if [[ ${{ github.event_name }} == push && (${{ github.ref_type }} == tag || (${{ github.ref_type }} == branch && ${{ github.ref_name }} == release/*)) ]]; then
79+ echo '::group::Enable version string sanitization'
80+ # This environment variable just has to exist and must not be empty. The actual value is arbitrary.
81+ # See docs/source/conf.py for details
82+ export RL_SANITIZE_VERSION_STR_IN_DOCS=1
83+ echo '::endgroup::'
84+ fi
85+
86+ # 10. Test torchrl installation
7887 mkdir _tmp
7988 cd _tmp
8089 PYOPENGL_PLATFORM=egl MUJOCO_GL=egl python3 -c """from torchrl.envs.libs.dm_control import DMControlEnv
8190 print(DMControlEnv('cheetah', 'run', from_pixels=True).reset())"""
8291 cd ..
8392
84- # 10 . Build doc
93+ # 11 . Build doc
8594 cd ./docs
8695 # timeout 7m bash -ic "MUJOCO_GL=egl sphinx-build ./source _local_build" || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi
8796 # bash -ic "PYOPENGL_PLATFORM=egl MUJOCO_GL=egl sphinx-build ./source _local_build" || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi
Original file line number Diff line number Diff line change 3939# The version info for the project you're documenting, acts as replacement for
4040# |version| and |release|, also used in various other places throughout the
4141# built documents.
42- #
43- # The short X.Y version.
44- version = "main (" + str (torchrl .__version__ ) + " )"
45- # The full version, including alpha/beta/rc tags.
46- # TODO: verify this works as expected
47- release = "main"
42+ # version: The short X.Y version.
43+ # release: The full version, including alpha/beta/rc tags.
44+ if os .environ .get ("RL_SANITIZE_VERSION_STR_IN_DOCS" , None ):
45+ # Turn 1.11.0aHASH into 1.11 (major.minor only)
46+ version = release = "." .join (torchrl .__version__ .split ("." )[:2 ])
47+ html_title = " " .join ((project , version , "documentation" ))
48+ else :
49+ version = f"main ({ torchrl .__version__ } )"
50+ release = "main"
4851
4952# The language for content autogenerated by Sphinx. Refer to documentation
5053# for a list of supported languages.
You can’t perform that action at this time.
0 commit comments