Skip to content

Conversation

@milldr
Copy link
Member

@milldr milldr commented Jan 6, 2026

what

  • Build action now always downloads pre-built library docs (removed all inline generation)
  • Production builds regenerate library docs (in parallel) before building
  • Preview builds use cached library docs from the latest release
  • Added npm caching to reduce install time (~2 min saved)
  • New generate-library.yml workflow builds library docs weekly (Monday 8am UTC)
  • Added rebuild-library-docs label to force library doc regeneration on PR previews

Expected Results

Build Phase Current After Savings
npm install 2-3 min ~30 sec ~2 min
Library docs 30+ min ~1 min (download) ~30 min
Docusaurus build 3-5 min 3-5 min 0
Total Preview 35-40 min 4-7 min ~30 min

How it works

Library Docs Generation (generate-library.yml)

The workflow generates docs in parallel across 3 jobs:

  1. Components - Terraform components docs
  2. Modules - Terraform modules docs
  3. GitHub Actions - GitHub Actions docs

After all jobs complete, a Package and Release job:

  1. Downloads artifacts from all 3 jobs
  2. Packages into library-docs.tar.gz
  3. Uploads to GitHub Release tagged library-docs-latest

This workflow runs:

  • Weekly (Monday 8am UTC) on schedule
  • On push to master/main when scripts/docs-collator/** changes
  • On manual trigger
  • Called by production workflow before each release
  • Called by preview workflow when rebuild-library-docs label is present

Build Action (simplified)

The build action (build-website) now only:

  1. Configures AWS credentials
  2. Sets up Node with npm caching
  3. Caches .build-harness
  4. Downloads pre-built library docs from library-docs-latest release
  5. Runs make build-production

The build will fail if no library-docs-latest release exists. The library docs workflow must run at least once to bootstrap.

Preview Builds (on PR)

  1. Downloads pre-built library docs from release
  2. Builds the site

Optional: Add the rebuild-library-docs label to force fresh library doc generation.

Production Builds

  1. Calls generate-library.yml to regenerate fresh library docs (parallel jobs)
  2. Downloads the freshly built tarball
  3. Builds and deploys

Changes Summary

New Files

  • .github/workflows/generate-library.yml - Parallel library docs generation workflow

Modified Files

  • .github/actions/build-website/action.yml
    • Added npm caching
    • Removed all library doc generation (Python, Atmos, terraform-docs, render scripts)
    • Now only downloads pre-built docs from GitHub Release
  • .github/workflows/website-deploy-preview.yml
    • Added optional rebuild-library-docs label support
    • Updated permissions for release creation
  • .github/workflows/website-deploy-release.yml
    • Now calls generate-library.yml before building
    • Updated permissions for release creation

Caching

Tool Location Cached?
npm build-website ✅ Yes
.build-harness build-website ✅ Yes (weekly)
pip generate-library ✅ Yes
terraform-docs generate-library ✅ Yes
Atmos generate-library ❌ No (fast download, no native support)

why

Preview builds were taking 35-40 minutes due to sequential library documentation generation. Since library content (components, modules, GitHub Actions docs) rarely changes during PR reviews, using pre-built docs is acceptable for preview environments while production always gets fresh docs.

references

  • Important: First run of generate-library.yml workflow required to bootstrap the library-docs-latest release before any builds will work
  • Artifacts used between jobs are free (public repo) and auto-deleted after workflow completion

… docs

- Add npm caching to reduce install time by ~2 minutes
- Create library-docs-generate.yml workflow to pre-build docs every 6 hours
- Add skip_library_docs input to build action
- Configure preview builds to use pre-built library docs instead of regenerating
- Conditionally skip Python/terraform-docs setup when using pre-built docs
- Production builds still generate fresh docs for accuracy

Preview builds now complete in 4-7 minutes instead of 15-23 minutes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add workflow_call trigger to library-docs-generate.yml
- Production workflow now calls library-docs-generate first
- Production uses freshly built library docs from the release
- Both preview and production now use the same tarball approach

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
When 'rebuild-library-docs' label is present on a PR, the preview build
will regenerate library docs before building (like production).
Default behavior uses pre-built docs from the latest release.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Remove skip_library_docs input - build action now always downloads pre-built docs
- Remove all library doc generation steps from build action (Python, Atmos, terraform-docs, render scripts)
- Build action will error if library-docs-latest release doesn't exist
- Removed .cache from cached paths (no longer needed)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Rename workflow file to generate-library.yml
- Update workflow name to "📚 Generate Library"
- Rename jobs to cleaner names: Components, Modules, GitHub Actions, Package and Release
- Update references in preview and release workflows

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@milldr milldr merged commit 87d9d00 into master Jan 6, 2026
1 of 2 checks passed
@milldr milldr deleted the milldr/docs-build-speedup branch January 6, 2026 17:28
@milldr milldr mentioned this pull request Jan 6, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants