correct launch admonition #22
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: Build & publish docs | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: {} | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: docs | |
| cancel-in-progress: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: "Set up Python" | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version-file: ".python-version" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| version: "latest" | |
| - name: Install dependencies | |
| run: uv sync --dev | |
| - name: Configure git (for mike pushes) | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| - name: Fetch gh-pages branch | |
| run: | | |
| git fetch origin gh-pages:gh-pages || echo "gh-pages branch doesn't exist yet (will be created by mike)" | |
| - name: Detect version from API docs | |
| id: version | |
| run: | | |
| if [ -f "docs/api/.api-version" ]; then | |
| FULL_VERSION=$(cat docs/api/.api-version | tr -d '[:space:]') | |
| # Convert v1.2.3 to v1.2 (major.minor only) | |
| VERSION=$(echo $FULL_VERSION | sed -E 's/^v?([0-9]+\.[0-9]+).*/v\1/') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "detected=true" >> $GITHUB_OUTPUT | |
| echo "Detected API version: $FULL_VERSION -> deploying as docs version: $VERSION" | |
| else | |
| echo "detected=false" >> $GITHUB_OUTPUT | |
| echo "No .api-version file found - skipping deployment" | |
| fi | |
| - name: Deploy versioned docs with mike | |
| if: steps.version.outputs.detected == 'true' | |
| env: | |
| CI: "true" | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| # Deploy the versioned documentation with 'latest' alias | |
| uv run mike deploy \ | |
| --push \ | |
| --remote origin \ | |
| --branch gh-pages \ | |
| --update-aliases \ | |
| $VERSION latest | |
| # Set latest as the default version | |
| uv run mike set-default \ | |
| --push \ | |
| --remote origin \ | |
| --branch gh-pages \ | |
| latest | |
| echo "✅ Deployed documentation version: $VERSION (aliased as 'latest')" | |
| - name: Verify deployment | |
| if: steps.version.outputs.detected == 'true' | |
| run: | | |
| git fetch origin gh-pages | |
| echo "✅ Latest commit on gh-pages:" | |
| git log origin/gh-pages -1 --oneline | |
| echo "" | |
| echo "📁 Files in gh-pages root:" | |
| git ls-tree --name-only origin/gh-pages | |
| echo "" | |
| echo "📚 Deployed versions:" | |
| git show origin/gh-pages:versions.json || echo "No versions.json yet" | |