Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix version wrangling in docs #7600

Merged
merged 6 commits into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 8 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ jobs:
pip install --progress-bar=off -r requirements.txt
echo '::endgroup::'

if [[ ${{ github.ref_type }} == tag || (${{ github.ref_type }} == branch && ${{ github.ref_name }} == release/*) ]]; then
echo '::group::Enable version wrangling'
# 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 VERSION=1
echo '::endgroup::'
fi

# The runner does not have sufficient memory to run with as many processes as there are
# cores (`-j auto`). Thus, we limit to a single process (`-j 1`) here.
sed -i -e 's/-j auto/-j 1/' Makefile
Expand Down
13 changes: 6 additions & 7 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,16 @@
# 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 (" + torchvision.__version__ + " )"
# The full version, including alpha/beta/rc tags.
release = "main"
# version: The short X.Y version.
# release: The full version, including alpha/beta/rc tags.
VERSION = os.environ.get("VERSION", None)
if VERSION:
# Turn 1.11.0aHASH into 1.11 (major.minor only)
version = ".".join(version.split(".")[:2])
version = release = ".".join(torchvision.__version__.split(".")[:2])
html_title = " ".join((project, version, "documentation"))
release = version
else:
version = f"main ({torchvision.__version__})"
release = "main"


# The language for content autogenerated by Sphinx. Refer to documentation
Expand Down