Skip to content

ci(api-docs): isolate per-package builds and stabilize root URL - #241

Merged
twishabansal merged 6 commits into
mainfrom
api-docs-per-package-isolation
Jun 4, 2026
Merged

ci(api-docs): isolate per-package builds and stabilize root URL#241
twishabansal merged 6 commits into
mainfrom
api-docs-per-package-isolation

Conversation

@twishabansal

@twishabansal twishabansal commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes two defects in the API reference docs pipeline (go.mcp-toolbox.dev) and cleans up the generation scripts:

  • Cross-package coupling: a single tag rebuilt all three packages into one shared folder, even though core, tbadk, and tbgenkit release on independent cadences. Now each per-package tag (core/v*, tbadk/v*, tbgenkit/v*) builds only that package at /<pkg>/<version>/ pushes to main build all three as //dev/.
  • Root URL flapping: the root index.html was regenerated on every run, so / ping-ponged between dev and the latest tagged version. The root (repo README) is now rebuilt only on tag pushes, so it tracks the latest release and stays stable between dev builds.

URL model after this PR

Ref pushed Builds Root /
push to main /core/dev/, /tbadk/dev/, /tbgenkit/dev/ untouched
tag core/v1.0.0 /core/v1.0.0/ only rebuilt from that tag's README
any other tag nothing (skipped) untouched

How it was tested

Tested locally against the exact CI Hugo version (0.152.2 extended).

1. Install the CI Hugo and lint the workflow

cd /tmp && rm -rf hugo-test && mkdir hugo-test && cd hugo-test
curl -sSL -o hugo.tar.gz \
  https://github.com/gohugoio/hugo/releases/download/v0.152.2/hugo_extended_0.152.2_darwin-universal.tar.gz
tar xzf hugo.tar.gz && ./hugo version
export PATH="/tmp/hugo-test:$PATH"

cd /Users/twishabansal/mcp-toolbox-sdk-go
go run github.com/rhysd/actionlint/cmd/actionlint@latest .github/workflows/api-docs.yml   # passes clean

2. Replay the two workflow scenarios into one shared public/ tree (mimics deploying a tag on top of the existing dev site, which is how isolation gets verified)

export PATH="/tmp/hugo-test:$PATH"
rm -rf docs-site/public

# SCENARIO 1: push to main -> all three packages at dev, no root rebuild
for pkg in core tbadk tbgenkit; do
  ./scripts/generate-api-docs.sh "$pkg" dev "http://localhost:8080/"
done

# SCENARIO 2: push tag core/v1.0.0 -> only core, plus root rebuild
./scripts/generate-api-docs.sh core v1.0.0 "http://localhost:8080/"
./scripts/generate-root.sh "http://localhost:8080/"

3. Assert isolation, stable root, and content

echo "core/v1.0.0 added?       $([ -d docs-site/public/core/v1.0.0 ] && echo YES || echo NO)"
echo "core/dev still intact?   $([ -d docs-site/public/core/dev ] && echo YES || echo NO)"
echo "tbadk/dev untouched?     $([ -d docs-site/public/tbadk/dev ] && echo YES || echo NO)"
echo "tbgenkit/dev untouched?  $([ -d docs-site/public/tbgenkit/dev ] && echo YES || echo NO)"
echo "root is README?          $(grep -qiE 'Quickstart|go get' docs-site/public/index.html && echo YES || echo NO)"
echo "root NOT a redirect?     $(grep -qi 'http-equiv.*refresh' docs-site/public/index.html && echo NO || echo YES)"
echo "v1.0.0 shows 'Viewing'?  $(grep -qiE 'Viewing' docs-site/public/core/v1.0.0/index.html && echo YES || echo NO)"
echo "v1.0.0 has API symbols?  $(grep -qE 'NewToolboxClient' docs-site/public/core/v1.0.0/index.html && echo YES || echo NO)"
echo "checked-in content kept? $([ -d docs-site/content/en ] && echo YES || echo NO)"

All assertions returned the expected values (isolation preserved, root is the README with 0 meta-refresh redirects, tag page shows Viewing v1.0.0 + gomarkdoc API symbols, docs-site/content not wiped).

4. Visual spot-check

cd docs-site/public && python3 -m http.server 8080
# browse http://localhost:8080/ , /core/dev/ , /core/v1.0.0/ , /tbadk/dev/ , /tbgenkit/dev/

Adds tags:['**'] so the API Reference Deployment workflow fires on tag
pushes, not just main. Inert until a tag is pushed; per-package routing
and root-redirect handling follow in subsequent PRs.
Routes each tag to a single package built at /<pkg>/<version>/, builds
dev from main, and rebuilds the root README only on tag pushes so the
root URL stops flapping. Drops the destructive content wipe and macOS
sed dance.
@twishabansal
twishabansal requested a review from a team as a code owner June 1, 2026 12:02
@twishabansal
twishabansal marked this pull request as draft June 2, 2026 06:50
@twishabansal
twishabansal force-pushed the api-docs-per-package-isolation branch 2 times, most recently from 652e6e7 to 1ac28c9 Compare June 2, 2026 08:01
@twishabansal
twishabansal marked this pull request as ready for review June 2, 2026 08:19
@twishabansal
twishabansal changed the base branch from main to enable-api-docs-tag-trigger June 2, 2026 08:21
Base automatically changed from enable-api-docs-tag-trigger to main June 2, 2026 08:53
@anubhav756 anubhav756 added the priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. label Jun 2, 2026
@twishabansal
twishabansal merged commit 5aa7ff3 into main Jun 4, 2026
17 checks passed
@twishabansal
twishabansal deleted the api-docs-per-package-isolation branch June 4, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants