diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b88cb898d..85c57a8fa 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -15,6 +15,8 @@ jobs: steps: # Check out source. - uses: actions/checkout@v2 + with: + fetch-depth: 0 # This ensures the entire history is fetched so we can switch branches - name: Set up Python uses: actions/setup-python@v1 @@ -42,6 +44,7 @@ jobs: - name: Get version + subdirectory run: | VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])") + echo "VERSION=$VERSION" >> $GITHUB_ENV echo "DOCS_SUBDIR=versions/$VERSION" >> $GITHUB_ENV # Get version from pyproject.toml. @@ -60,3 +63,24 @@ jobs: keep_files: false # This will only erase the destination subdirectory. cname: viser.studio if: github.event_name != 'pull_request' + + # We'll maintain an index of all versions under viser.studio/versions. + # This will be useful for dynamically generating lists of possible doc links. + - name: Update versions index.txt + run: | + git checkout . # Revert change to pyproject.toml from earlier... + git checkout gh-pages + git pull + git config --global user.email "yibrenth@gmail.com" + git config --global user.name "Brent Yi" + FILE="versions/index.txt" # Replace with your file path + if ! grep -qx "$VERSION" "$FILE"; then + echo "$VERSION" >> "$FILE" + git add $FILE + git commit -m "Update versions.txt with new version $VERSION" + git push origin gh-pages + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: ${{ env.VERSION }} + if: github.event_name == 'push' # TODO: should be release. diff --git a/docs/source/_static/css/custom.css b/docs/source/_static/css/custom.css index e0cb38f85..45a20238f 100644 --- a/docs/source/_static/css/custom.css +++ b/docs/source/_static/css/custom.css @@ -2,8 +2,3 @@ img.sidebar-logo { width: 5em; margin: 1em 0 0 0; } -.sidebar-brand-text { - font-size: 1rem; - font-weight: 600; - font-style: italic; -} diff --git a/docs/source/_templates/sidebar/brand.html b/docs/source/_templates/sidebar/brand.html index cc5b72478..a50ed4b9d 100644 --- a/docs/source/_templates/sidebar/brand.html +++ b/docs/source/_templates/sidebar/brand.html @@ -9,11 +9,47 @@ {%- endif %} - {{ version }} + - + {% endblock brand_content %} + + + +