Deploy Sphinx documentation to Pages #78
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Sphinx documentation to Pages | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| release: | |
| types: [ "published" ] | |
| jobs: | |
| pages: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| cd docs | |
| pip install -r requirements.txt | |
| - name: Get latest release tag | |
| run: | | |
| latest_tag=$(git tag -l "v*.*.*" | grep -E "^v[0-9]+\.[0-9]+\.[0-9]+$" | sort -V | tail -1) | |
| if [ -z "$latest_tag" ]; then | |
| echo "No release tags found, using fallback" | |
| latest_tag="v1.0.0" | |
| fi | |
| echo "LATEST_RELEASE_TAG=$latest_tag" >> $GITHUB_ENV | |
| echo "Latest release tag: $latest_tag" | |
| - name: Build all versions (tags + master) | |
| run: | | |
| cd docs | |
| sphinx-multiversion . _build | |
| cp assets/gh-pages-redirect.html _build/index.html | |
| # Create 'latest' directory pointing to actual latest release | |
| if [ ! -z "$LATEST_RELEASE_TAG" ]; then | |
| cp -r "_build/$LATEST_RELEASE_TAG" "_build/latest" | |
| echo "Created latest directory pointing to $LATEST_RELEASE_TAG" | |
| fi | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: docs/_build |