Repository navigation
ci(docs): build & deploy Astro docs to gh-pages with PR previews - #78
Merged
Merged
Conversation
The docs.yml workflow now builds the new Astro site under `docs/`, publishes it to the root of the gh-pages branch on push to main, and deploys a per-PR preview to `pr-preview/pr-<N>/` on every pull request that touches `docs/` (or the workflow itself). Workflow shape - `build` — single source of truth for the static site. Installs Node 20, runs `npm ci` against `docs/package-lock.json`, invokes `npx astro build` with `PPVM_BASE` set to either `/` (main) or `/pr-preview/pr-<N>` (PR). Upload the bundle as an artifact so downstream jobs deploy the *same* bytes that were verified to build. Skipped on close events (only cleanup runs there). - `deploy-main` — push artifact to `gh-pages` root via peaceiris/actions-gh-pages with `keep_files: true`. The `keep_files` flag preserves `/rust-api/` (managed by `rust-docs.yml`) and any `/pr-preview/*` content (managed by the preview job below). - `deploy-preview` — rossjrw/pr-preview-action@v1 publishes the artifact to `gh-pages/pr-preview/pr-<N>/`. - `cleanup-preview` — same action with `action: remove` on PR close. Path-scoped triggers: PR events only fire when `docs/**` or this workflow file changed, so Rust- or Python-only PRs don't trigger a docs build. The API JSON consumed by `/api/` is committed under `docs/src/data/`; regenerating it requires the nightly Rust toolchain and is a manual local step (`docs/scripts/extract-rust.mjs`). Astro config - `astro.config.mjs` now reads `PPVM_SITE` and `PPVM_BASE` from env, defaulting to `/` so `npx astro dev` and unscoped local builds keep working unchanged. CI sets `PPVM_BASE` per deploy target. README badge now points at the gh-pages root rather than the legacy `/dev/` mkdocs path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
docs/src/data/{rust,python}-api.json are .gitignore'd and produced by
docs/scripts/extract-{rust,python}.mjs. The previous version of this
workflow assumed they were committed; CI failed with
'Could not resolve "../data/rust-api.json" from src/pages/api.astro'.
This commit:
- Installs nightly Rust (the rustdoc-JSON output format requires it)
- Installs uv (the Python extractor invokes 'uv run --with griffe')
- Runs both extractors before 'npx astro build'.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR replaces the legacy MkDocs deployment workflow with an Astro-based docs build and GitHub Pages publishing flow, including PR preview deployments.
Changes:
- Updates the docs workflow to build
docs/with Node/Astro and deploy togh-pages. - Adds environment-driven Astro
site/baseconfiguration. - Updates the README documentation badge link to the new Pages root.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
README.md |
Updates the documentation badge target URL. |
docs/astro.config.mjs |
Makes Astro site and base configurable via environment variables. |
.github/workflows/docs.yml |
Replaces MkDocs/mike deployment with Astro build, main deploy, PR preview deploy, and cleanup jobs. |
Comments suppressed due to low confidence (2)
.github/workflows/docs.yml:125
- Preview deployments also push to the same
gh-pagesbranch asdeploy-main, but they are not in thedeploy-docsconcurrency group. A PR preview update or cleanup that overlaps a main deploy can race on the branch, causing one push to fail or the main deploy to preserve a stale preview snapshot. Serialize all gh-pages writers with the same concurrency group if previews and root docs are meant to coexist reliably.
- uses: actions/download-artifact@v4
with:
name: docs-dist
path: docs/dist/
.github/workflows/docs.yml:143
- Cleanup removes a directory from the same
gh-pagesbranch used by the root docs deploy, but it is not serialized withdeploy-main(or the Rust docs deploy). If a cleanup overlaps another gh-pages publish, one action may push from a stale checkout or fail with a non-fast-forward error, leaving previews or docs in the wrong state. Use a shared concurrency group for all gh-pages writers.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+24
to
+30
| types: [opened, synchronize, reopened, closed] | ||
| paths: | ||
| # Site sources. Other paths (crates/, ppvm-python/) don't affect | ||
| # the build because the API JSON consumed by /api/ is committed | ||
| # under docs/src/data/ and regenerated manually. | ||
| - "docs/**" | ||
| - ".github/workflows/docs.yml" |
Comment on lines
+100
to
+102
| PPVM_BASE: ${{ steps.compute-base.outputs.base }} | ||
| run: npx astro build | ||
|
|
Comment on lines
+5
to
+8
| // · local dev: PPVM_SITE=http://localhost:4321 PPVM_BASE=/ | ||
| // · main → gh-pages: PPVM_SITE=https://queracomputing.github.io PPVM_BASE=/ppvm | ||
| // · PR preview deploy: PPVM_SITE=https://queracomputing.github.io PPVM_BASE=/ppvm/pr-preview/pr-<N> | ||
| const site = process.env.PPVM_SITE ?? "https://queracomputing.github.io"; |
Comment on lines
+76
to
+85
| id: compute-base | ||
| run: | | ||
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | ||
| echo "base=/pr-preview/pr-${{ github.event.pull_request.number }}" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "base=/" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - name: Generate API JSON | ||
| # The /api/ page reads docs/src/data/{rust,python}-api.json, |
|
Collaborator
Author
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/QuEraComputing/ppvm/sessions/10e9393a-1558-4794-8568-221858564600 Co-authored-by: Roger-luo <8445510+Roger-luo@users.noreply.github.com>
Implemented the requested thread fixes in commit
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the legacy
mkdocs+mikedeploy indocs.ymlwith an Astro build that publishes the new site underdocs/to GitHub Pages, plus per-PR previews underpr-preview/pr-<N>/.What changed
.github/workflows/docs.ymlFour jobs:
buildnpm ciindocs/, runsnpx astro buildwith the appropriatePPVM_BASE(/for main,/pr-preview/pr-<N>for PRs). Uploadsdocs/dist/as an artifact.deploy-mainpeaceiris/actions-gh-pages@v3withkeep_files: true(preserves/rust-api/fromrust-docs.ymland any active/pr-preview/*).deploy-previewrossjrw/pr-preview-action@v1push it togh-pages/pr-preview/pr-<N>/.cleanup-previewaction: remove— drops the preview directory.The
buildjob runs once and feeds both deploy jobs, so PRs are guaranteed to deploy the exact bundle that was verified to build.PR triggers are scoped to
docs/**+ the workflow file: Rust- or Python-only PRs don't fire a docs build. The/api/page reads JSON committed underdocs/src/data/; regenerating it needs the nightly Rust toolchain and stays a manual local step (docs/scripts/extract-rust.mjs).docs/astro.config.mjsReads
PPVM_SITEandPPVM_BASEfrom env, defaults to/sonpx astro devand unscoped local builds still work without env tweaks. CI setsPPVM_BASEper deploy target.README.mdBadge URL updated from
/dev/(legacy mkdocs path) to the gh-pages root.Test plan
deploy-previewruns and posts a preview URL comment on the PR./pr-preview/pr-N/…(verified locally withPPVM_BASE=/pr-preview/pr-99 npx astro build).deploy-mainwrites to the gh-pages branch root;/rust-api/(fromrust-docs.yml) and any active PR preview directory are preserved bykeep_files: true.cleanup-preview, removingpr-preview/pr-<N>/from gh-pages.What this PR does not do
ppvm-python/docs/or the stale/dev/content currently ongh-pages. Both can go in a follow-up sweep.rust-docs.yml; that workflow still owns/rust-api/independently.🤖 Generated with Claude Code