|
| 1 | +name: CI Docs |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + deploy: |
| 11 | + description: "Publish the built site to GitHub Pages" |
| 12 | + type: boolean |
| 13 | + default: false |
| 14 | + |
| 15 | +# The repo is private and the docs are under review, so the site is NOT |
| 16 | +# auto-published yet. `build-docs` runs on every push/PR to catch breakage. |
| 17 | +# `publish-docs` only runs on manual `workflow_dispatch` with `deploy=true`. |
| 18 | +# Once the doc review pass is complete, flip the publish trigger to |
| 19 | +# `if: github.ref == 'refs/heads/main'` (tracked in the go-live issue). |
| 20 | +jobs: |
| 21 | + build-docs: |
| 22 | + name: "Build Docs" |
| 23 | + runs-on: ubuntu-latest |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v4 |
| 26 | + with: |
| 27 | + fetch-depth: 0 # Full history for accurate page timestamps |
| 28 | + |
| 29 | + - name: Install uv |
| 30 | + uses: astral-sh/setup-uv@v8.2.0 |
| 31 | + |
| 32 | + - name: Install package and dependencies |
| 33 | + # uv sync installs the locked dependency set from uv.lock, so CI |
| 34 | + # resolves the exact versions used in local dev. |
| 35 | + run: uv sync --all-extras |
| 36 | + |
| 37 | + - name: Register `python3` Jupyter kernel |
| 38 | + # .qmd files (and great-docs.yml) declare `jupyter: python3`, so the |
| 39 | + # CI runner needs a kernelspec under that name pointing at the same |
| 40 | + # Python interpreter the package was installed into above. |
| 41 | + run: uv run python -m ipykernel install --user --name python3 |
| 42 | + |
| 43 | + - name: Set up Quarto |
| 44 | + uses: quarto-dev/quarto-actions/setup@v2 |
| 45 | + |
| 46 | + - name: Build docs |
| 47 | + run: uv run great-docs build |
| 48 | + |
| 49 | + - name: Verify agent-context files were generated |
| 50 | + # great-docs writes llms.txt / llms-full.txt / skill.md at build step, |
| 51 | + # but llms-full.txt is only emitted if `import tidydraws` succeeds and |
| 52 | + # that failure is swallowed. Assert the files landed in _site so a |
| 53 | + # silent skip fails CI instead of shipping an incomplete site. |
| 54 | + run: | |
| 55 | + for f in llms.txt llms-full.txt skill.md; do |
| 56 | + if [[ ! -s "great-docs/_site/$f" ]]; then |
| 57 | + echo "::error::great-docs/_site/$f missing or empty after build" |
| 58 | + exit 1 |
| 59 | + fi |
| 60 | + echo "OK: $f ($(wc -c < "great-docs/_site/$f") bytes)" |
| 61 | + done |
| 62 | +
|
| 63 | + - name: Save docs artifact |
| 64 | + uses: actions/upload-artifact@v4 |
| 65 | + with: |
| 66 | + name: docs-html |
| 67 | + path: great-docs/_site |
| 68 | + |
| 69 | + publish-docs: |
| 70 | + name: "Publish Docs" |
| 71 | + runs-on: ubuntu-latest |
| 72 | + needs: "build-docs" |
| 73 | + if: github.event_name == 'workflow_dispatch' && inputs.deploy |
| 74 | + permissions: |
| 75 | + pages: write |
| 76 | + id-token: write |
| 77 | + environment: |
| 78 | + name: github-pages |
| 79 | + url: ${{ steps.deployment.outputs.page_url }} |
| 80 | + steps: |
| 81 | + - uses: actions/download-artifact@v4 |
| 82 | + with: |
| 83 | + name: docs-html |
| 84 | + path: great-docs/_site |
| 85 | + |
| 86 | + - name: Upload Pages artifact |
| 87 | + uses: actions/upload-pages-artifact@v3 |
| 88 | + with: |
| 89 | + path: great-docs/_site |
| 90 | + |
| 91 | + - name: Deploy to GitHub Pages |
| 92 | + id: deployment |
| 93 | + uses: actions/deploy-pages@v4 |
0 commit comments