Skip to content

Commit

Permalink
Separate latest/ and versions/ subdirectories for docs
Browse files Browse the repository at this point in the history
  • Loading branch information
brentyi committed May 24, 2024
1 parent 645bfb0 commit e8d7b60
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
docs:
runs-on: ubuntu-latest
steps:
# Check out source
# Check out source.
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.10"

# Build documentation
# Build documentation.
- name: Building documentation
run: |
pip install uv
Expand All @@ -30,20 +30,24 @@ jobs:
sphinx-build docs/source docs/build -b dirhtml
# Get version from pyproject.toml.
- name: Extract version
id: get_version
- name: Get version + subdirectory
run: |
VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")
echo "version_subdir=versions/$VERSION" >> $GITHUB_OUTPUT
echo "DOCS_SUBDIR=versions/$VERSION" >> $GITHUB_ENV
# Get version from pyproject.toml.
- name: Override subdirectory to `latest/` for pushes
run: |
echo "DOCS_SUBDIR=latest" >> $GITHUB_ENV
if: github.event_name == 'push'

# Deploy to version-dependent subdirectory.
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build
# TODO: only set this to the version number for release actions.
destination_dir: ${{ steps.get_version.outputs.version_subdir }}
keep_files: false # This will only erase the destination subdirectory.
destination_dir: ${{ env.DOCS_SUBDIR }}
keep_files: false # This will only erase the destination subdirectory.
cname: viser.studio
if: github.event_name != 'pull_request'

0 comments on commit e8d7b60

Please sign in to comment.