feat(docs): add ephemeral per-PR documentation previews - #789
Closed
nx-plugin-for-aws wants to merge 3 commits into
Closed
feat(docs): add ephemeral per-PR documentation previews#789nx-plugin-for-aws wants to merge 3 commits into
nx-plugin-for-aws wants to merge 3 commits into
Conversation
Builds the docs site for each PR touching docs/** and publishes an isolated, ephemeral preview to S3/CloudFront, commenting the link back on the PR. Build runs in the pull_request context; deploy runs via workflow_run behind a required-reviewer environment gate. Previews are removed when the PR closes. Adds a standalone CDK app (docs-preview-infra) that provisions the private S3 bucket, CloudFront distribution, and GitHub OIDC deploy role.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #789 +/- ##
=======================================
Coverage 87.22% 87.22%
=======================================
Files 140 140
Lines 4987 4987
Branches 1164 1164
=======================================
Hits 4350 4350
Misses 338 338
Partials 299 299 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
added 2 commits
June 11, 2026 02:00
The docs site is self-contained Astro content and does not need the compiled plugin. Excluding task dependencies avoids running the full plugin build and test suite on the preview build runner.
The bare GitHub-hosted runner rendered the site's D2 diagrams through the WASM port single-threaded, taking 40+ minutes. Building on the multi-core CodeBuild runner (without AWS credentials, matching how pr.yml runs fork smoke tests) keeps the preview build fast.
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.
Reason for this change
Reviewers currently have to build the documentation site locally to see how doc changes render. This adds an automatic, isolated preview of the docs site for every pull request that touches
docs/**, with the link commented back on the PR.Description of changes
Adds a per-PR documentation preview system:
pr-docs-preview.yml(pull_request) — builds the docs site withDOCS_BASE_PATH=/pr-<n>so all assets and links resolve under the PR's preview subpath, and uploads the result as an artifact.pr-docs-preview-deploy.yml(workflow_run) — downloads the artifact, syncs it to an S3 prefix (pr-<n>/), invalidates CloudFront, and posts/updates a comment with the preview link. The deploy job uses adocs-previewenvironment with required reviewers, so a maintainer approves each preview deployment before it is published.pr-docs-preview-cleanup.yml(pull_request_targeton close) — removes the PR's preview prefix from S3.docs-preview-infra/— a standalone CDK app (deployed manually by maintainers, separate from the Nx workspace) that provisions a private S3 bucket, a CloudFront distribution with Origin Access Control and a URL-rewrite function for Astro's directory-style routes, and a GitHub OIDC deploy role scoped to this repo's default branch.Each PR's preview is isolated under its own
pr-<n>/key prefix on a single shared distribution. Previews are ephemeral — removed when the PR closes, with an S3 lifecycle rule expiring any stragglers. Production docs on GitHub Pages are unaffected; this is purely additive.One-time maintainer setup is documented in
docs-preview-infra/README.md: deploy the CDK app, set the four repository secrets from the stack outputs, and create thedocs-previewenvironment with required reviewers.Description of how you validated changes
DOCS_BASE_PATH=/pr-786 nx run docs:build) produces output with the correct subpath baked into asset URLs and links, and a root redirect to/pr-<n>/en.Issue # (if applicable)
N/A
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license