docs #1
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 | |
| # Publish the pdoc API reference to GitHub Pages. Modeled on zignal's | |
| # documentation.yml, minus the Zig half: one job builds the docs, one deploys. | |
| # | |
| # The docs are generated from the bundled browser binary (the tool methods are | |
| # regenerated from its MCP schemas before pdoc runs), so this fetches the same | |
| # release asset the wheels workflow bundles. It runs on release so the | |
| # published reference matches the wheel on PyPI, or by hand for any browser | |
| # tag (nightly included) to preview. | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| release: | |
| description: "browser release tag to document (nightly or a version tag)" | |
| default: "nightly" | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| env: | |
| BROWSER_REPO: lightpanda-io/browser | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v5 | |
| - name: Resolve browser release tag | |
| id: params | |
| run: | | |
| if [ "${{ github.event_name }}" = release ]; then | |
| echo "release_tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "release_tag=${{ inputs.release }}" >> "$GITHUB_OUTPUT" | |
| fi | |
| cat "$GITHUB_OUTPUT" | |
| - name: Download the release binary | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release download "${{ steps.params.outputs.release_tag }}" -R "$BROWSER_REPO" \ | |
| -p lightpanda-x86_64-linux -O lightpanda-bin | |
| chmod +x lightpanda-bin | |
| ./lightpanda-bin version | |
| - name: Set package version from tag | |
| if: steps.params.outputs.release_tag != 'nightly' | |
| run: | | |
| # Same rule as wheels.yml: package version == browser release tag. | |
| tag="${{ steps.params.outputs.release_tag }}" | |
| sed -i "s/^version = .*/version = \"${tag#v}\"/" pyproject.toml | |
| grep '^version' pyproject.toml | |
| - name: Build docs | |
| env: | |
| LIGHTPANDA_BIN: ${{ github.workspace }}/lightpanda-bin | |
| run: uv run --group docs python scripts/build_docs.py | |
| - uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: docs | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - id: deployment | |
| uses: actions/deploy-pages@v4 |