diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b88cb898d..6245dbf6f 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. @@ -59,4 +62,19 @@ jobs: destination_dir: ${{ env.DOCS_SUBDIR }} keep_files: false # This will only erase the destination subdirectory. cname: viser.studio - if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request + + - name: Update versions index.txt + run: | + git checkout gh-pages + FILE="versions/index.txt" # Replace with your file path + if ! grep -qx "$VERSION" "$FILE"; then + echo "$VERSION" >> "$FILE" + git add path/to/versions.txt + 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 %} + + + +