Skip to content

Commit

Permalink
Versioning Docs (pytorch#474)
Browse files Browse the repository at this point in the history
* Added method to version docs

* Update .travis.yml
  • Loading branch information
anmolsjoshi authored and vfdev-5 committed Apr 4, 2019
1 parent a221879 commit 9e6605b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,12 @@ jobs:

install:
- pip install -r docs/requirements.txt
# `pip install .` vs `python setup.py install` : 1st works better to produce _module/ignite with source links
- pip install .
- pip install git+https://github.com/anmolsjoshi/sphinxcontrib-versioning.git

script:
- cd docs && make html
- sphinx-versioning --use-master-conf build --whitelist-branches master docs/source docs/build/html
# Create .nojekyll file to serve correctly _static and friends
- touch build/html/.nojekyll
- touch docs/build/html/.nojekyll
after_success: # Nothing to do

# Deploy built docs when PR is merged to master
Expand Down
16 changes: 12 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))
import ignite
import sphinx_rtd_theme

Expand All @@ -25,7 +25,15 @@
author = 'Torch Contributors'

# The short X.Y version
version = 'master (' + ignite.__version__ + ' )'
try:
version = os.environ['code_version']
if 'master' in version:
version = 'master (' + ignite.__version__ + ')'
else:
version = version.replace('v', '')
except KeyError:
version = ignite.__version__

# The full version, including alpha/beta/rc tags
release = 'master'

Expand Down

0 comments on commit 9e6605b

Please sign in to comment.