diff --git a/.circleci/config.yml b/.circleci/config.yml index 18051686680..3de0894304b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1069,7 +1069,8 @@ jobs: # Don't use "checkout" step since it uses ssh, which cannot git push # https://circleci.com/docs/2.0/configuration-reference/#checkout set -ex - tag=${CIRCLE_TAG:1:5} + # Change v1.12.1rc1 into 1.12 (only major.minor) + tag=$(echo $CIRCLE_TAG | sed -e 's/v*\([0-9]*\.[0-9]*\).*/\1/') target=${tag:-main} ~/workspace/.circleci/build_docs/commit_docs.sh ~/workspace $target diff --git a/.circleci/config.yml.in b/.circleci/config.yml.in index 76d90274be3..e36b368db1c 100644 --- a/.circleci/config.yml.in +++ b/.circleci/config.yml.in @@ -1069,7 +1069,8 @@ jobs: # Don't use "checkout" step since it uses ssh, which cannot git push # https://circleci.com/docs/2.0/configuration-reference/#checkout set -ex - tag=${CIRCLE_TAG:1:5} + # Change v1.12.1rc1 into 1.12 (only major.minor) + tag=$(echo $CIRCLE_TAG | sed -e 's/v*\([0-9]*\.[0-9]*\).*/\1/') target=${tag:-main} ~/workspace/.circleci/build_docs/commit_docs.sh ~/workspace $target diff --git a/docs/source/conf.py b/docs/source/conf.py index e5b200f4a42..d09a33c3064 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -20,6 +20,8 @@ # import sys # sys.path.insert(0, os.path.abspath('.')) +import os + import pytorch_sphinx_theme import torchvision @@ -80,11 +82,16 @@ # built documents. # # The short X.Y version. -# TODO: change to [:2] at v1.0 version = "main (" + torchvision.__version__ + " )" # The full version, including alpha/beta/rc tags. -# TODO: verify this works as expected release = "main" +VERSION = os.environ.get("VERSION", None) +if VERSION: + # Turn 1.11.0aHASH into 1.11 (major.minor only) + version = ".".join(version.split(".")[:2]) + html_title = " ".join((project, version, "documentation")) + release = version + # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages.