merge: a domain reduction leads its name and wraps the projection #523
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: docs | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| tags: | |
| - "v[0-9]+.[0-9]+.[0-9]+" | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "docs-${{ github.ref }}" | |
| cancel-in-progress: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/install-project | |
| with: | |
| python-version: "3.12" | |
| - id: version | |
| run: | | |
| ref_name="${{ github.ref_name }}" | |
| # Remove 'v' prefix if present for version matching | |
| clean_name="${ref_name#v}" | |
| if [[ $clean_name =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| # Extract the major and minor version from the tag, preserve v prefix | |
| version="v$(echo $clean_name | cut -d. -f1-2)" | |
| tagged=true | |
| elif [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| # For pull requests, use pr-<number> | |
| version="pr-${{ github.event.pull_request.number }}" | |
| tagged=false | |
| else | |
| # Use the branch name as the version | |
| version=${{ github.ref_name }} | |
| tagged=false | |
| fi | |
| echo "version=$version" >> $GITHUB_OUTPUT | |
| echo "tagged=$tagged" >> $GITHUB_OUTPUT | |
| # (Removed legacy subtract_standardnames step) | |
| - name: Prune submit docs directory | |
| if: github.ref_name == 'submit' | |
| run: find docs -name "*.md" ! -name "index.md" -type f -delete | |
| - name: Build branch documentation | |
| run: | | |
| git fetch origin gh-pages --depth=1 | |
| git config user.name github-actions[bot] | |
| git config user.email github-actions[bot]@users.noreply.github.com | |
| uv run mike deploy "${{ steps.version.outputs.version }}" --allow-empty --title ${{ github.ref_name }} | |
| env: | |
| SITE_URL: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }} | |
| - name: Update mike alias and set default | |
| if: steps.version.outputs.tagged == 'true' | |
| run: | | |
| uv run mike alias "${{ steps.version.outputs.version }}" "latest" --update-aliases | |
| uv run mike set-default latest | |
| - name: Set default version | |
| if: steps.version.outputs.tagged != 'true' && github.ref_name == 'main' | |
| run: uv run mike set-default main | |
| deploy: | |
| if: github.event_name != 'pull_request' | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: gh-pages | |
| - uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: . | |
| retention-days: 1 | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |