Deploy Documentation #147
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 Documentation | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| description: 'Branch to deploy docs from' | |
| required: true | |
| default: 'main' | |
| type: choice | |
| options: | |
| - main | |
| - 2.x | |
| version_alias: | |
| description: 'Version alias for docs (e.g., 3.x, 2.x)' | |
| required: true | |
| default: '3.x' | |
| type: choice | |
| options: | |
| - 3.x | |
| - 2.x | |
| set_latest: | |
| description: 'Set this version as latest?' | |
| required: true | |
| default: true | |
| type: boolean | |
| jobs: | |
| deploy-docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.branch }} | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version-file: ".python-version" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Install dependencies | |
| run: uv sync --group docs --frozen | |
| - name: Configure Git for mike | |
| run: | | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| - name: Deploy docs with mike | |
| run: | | |
| # Fetch gh-pages branch if it exists | |
| git fetch origin gh-pages:gh-pages || true | |
| # Deploy the version | |
| if [ "${{ github.event.inputs.set_latest }}" = "true" ]; then | |
| uv run mike deploy --push --update-aliases ${{ github.event.inputs.version_alias }} latest | |
| uv run mike set-default --push latest | |
| else | |
| uv run mike deploy --push ${{ github.event.inputs.version_alias }} | |
| fi |