Repository navigation
Install each device stack only where its driver is claimed, adding CPU pools and AMD serving #264
Workflow file for this run
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 | ||
|
Check warning on line 1 in .github/workflows/docs.yml
|
||
| # The docs site lives in modelplaneai/docs-site: the Hugo project, the theme, | ||
| # the build, and the Vercel project. This repo owns the prose and tells that | ||
| # repo when to render it. Nothing here builds the site, and nothing there | ||
| # writes back to this repo. | ||
| # | ||
| # On a pull request, the site deploys a preview of that revision and aliases it | ||
| # to a hostname derived from the pull request number - which is why the link | ||
| # can be posted here immediately, from this repo's own token, before that build | ||
| # finishes. | ||
| # | ||
| # On a merge, the site rebuilds every version from the tip of each branch it | ||
| # serves. That is what publishes a docs change: nothing pins a content | ||
| # revision, so publishing is a rebuild. | ||
| # | ||
| # The trigger is pull_request_target so that a fork's pull request is previewed | ||
| # too. That runs this workflow in the base repository's context, with secrets, | ||
| # so it must never execute anything from the pull request - and it doesn't: | ||
| # there is no checkout here, and no step reads a file from the branch. Never | ||
| # add one. | ||
| on: | ||
| pull_request_target: | ||
| paths: ['docs/**', 'apis/**'] | ||
| push: | ||
| branches: [main, 'release-*'] | ||
| paths: ['docs/**', 'apis/**'] | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| concurrency: | ||
| group: docs-${{ github.head_ref || github.ref }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| render: | ||
| # Forks inherit this workflow but not the app id and key it needs, so the | ||
| # token mint fails there. Only the canonical repo can dispatch to the site. | ||
| if: github.repository == 'modelplaneai/modelplane' | ||
| runs-on: ubuntu-24.04 | ||
| env: | ||
| SITE_REPO: modelplaneai/docs-site | ||
| steps: | ||
| # Dispatching to another repository needs a credential this repo's own | ||
| # token cannot provide. A GitHub App installed on the site repo alone | ||
| # mints one that expires in an hour and belongs to no person, so it does | ||
| # not quietly die when someone leaves. Contents: read & write is the | ||
| # permission repository_dispatch requires. | ||
| - name: Mint a token for the site repo | ||
| id: token | ||
| uses: actions/create-github-app-token@v2 | ||
| with: | ||
| app-id: ${{ vars.DOCS_SITE_APP_ID }} | ||
| private-key: ${{ secrets.DOCS_SITE_APP_KEY }} | ||
| owner: modelplaneai | ||
| repositories: docs-site | ||
| # The head sha rather than the merge commit: it is what the reviewer is | ||
| # reading. A fork's commits are reachable here through refs/pull/<n>/head, | ||
| # so the site can fetch that sha from this repo without knowing the fork | ||
| # exists. | ||
| - name: Request a preview | ||
| if: github.event_name == 'pull_request_target' | ||
| env: | ||
| GH_TOKEN: ${{ steps.token.outputs.token }} | ||
| REF: ${{ github.event.pull_request.head.sha }} | ||
| PR: ${{ github.event.number }} | ||
| run: | | ||
| gh api "repos/$SITE_REPO/dispatches" \ | ||
| -f event_type=content-preview \ | ||
| -f "client_payload[ref]=$REF" \ | ||
| -f "client_payload[pr]=$PR" | ||
| # Once per pull request. The hostname follows from the number, so it | ||
| # stays correct as the branch is pushed to and rebuilt. | ||
| - name: Post the preview link | ||
| if: github.event.action == 'opened' || github.event.action == 'reopened' | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| PR: ${{ github.event.number }} | ||
| run: | | ||
| gh pr comment "$PR" --repo "$GITHUB_REPOSITORY" --body \ | ||
| "Docs preview: https://modelplane-docs-pr-${PR}.vercel.app (ready once the site's Content workflow finishes)" | ||
| - name: Publish | ||
| if: github.event_name == 'push' | ||
| env: | ||
| GH_TOKEN: ${{ steps.token.outputs.token }} | ||
| run: | | ||
| gh api "repos/$SITE_REPO/dispatches" \ | ||
| -f event_type=content-published | ||