Add shared build scripts and fix Docusaurus build errors#42
Merged
Conversation
Fix Docusaurus build errors caused by upstream issues (missing sidebar entries, blog truncation warnings) and reduce duplication between the workflow and shell scripts. - Create patch-docs-source.sh: shared script that validates sidebar entries, suppresses blog truncation warnings, fixes blog include pattern, and runs fix-mdx-compat.py - Create build-latest.sh: local build script for main branch docs - Update build-archived-version.sh to use patch-docs-source.sh - Update workflow to call patch-docs-source.sh and inline-raw-loader.py instead of inline perl for versioned docs
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
patch-docs-source.sh(new): Shared script that patches llama-stack docs source for a clean Docusaurus build. Handles sidebar validation (removes entries for non-existent doc files), suppresses blog truncation warnings, fixes blog include pattern for.mdx, and runsfix-mdx-compat.py.build-latest.sh(new): Local build script for main branch docs, mirrorsbuild-archived-version.shbut for the latest version. Supports--llama-stack-dirand--output-dirflags.build-archived-version.sh(modified): Replaced individualfix-mdx-compat.pycall and blog include fix with a single call topatch-docs-source.sh..github/workflows/build-and-deploy.yml(modified): Added Python setup, added "Patch docs source" step, replaced inline perl raw-loader path fixing withinline-raw-loader.py.Motivation
The Docusaurus build fails when building from llama-stack's
mainbranch due to upstream issues:advanced_apis/post_training,providers/agents/index,providers/agents/inline_builtin) referenced insidebars.tsbut missing upstreamThese are upstream doc structure issues. The fix makes the build pipeline resilient to them via
patch-docs-source.sh, which is shared across the workflow and both local build scripts.The workflow also had build logic (MDX fixing, raw-loader path patching) duplicated from the shell scripts. This PR consolidates that into the shared scripts.
Test plan
python3 -c "import yaml; yaml.safe_load(open('.github/workflows/build-and-deploy.yml'))"bash -n patch-docs-source.sh && bash -n build-latest.sh && bash -n build-archived-version.shbuild-latest.shagainst a fresh llama-stack clone to verify full build succeedsworkflow_dispatchto verify CI build succeeds