Add version switcher to layout template #4
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: Publish Docs | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - development | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Fetch all branches | |
| run: git fetch origin '+refs/heads/*:refs/remotes/origin/*' | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version: "3.12" | |
| enable-cache: true | |
| - name: Build Multi-version Docs | |
| run: | | |
| uv run --with-requirements docs/requirements.txt sphinx-multiversion docs/source docs/build/html | |
| - name: Create Redirect Root | |
| run: | | |
| # Redirects root URL (repo.io/) to the main branch docs (repo.io/main/) | |
| echo '<meta http-equiv="refresh" content="0; url=main/index.html">' > docs/build/html/index.html | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_branch: gh-pages | |
| publish_dir: docs/build/html |