Skip to content

ci: docs-build PR validation + cross-repo publish dispatch#1988

Draft
jeffredodd wants to merge 3 commits into
mainfrom
jeff/docs-publishing-pipeline
Draft

ci: docs-build PR validation + cross-repo publish dispatch#1988
jeffredodd wants to merge 3 commits into
mainfrom
jeff/docs-publishing-pipeline

Conversation

@jeffredodd
Copy link
Copy Markdown
Contributor

@jeffredodd jeffredodd commented Jun 1, 2026

Summary

Sets up the SDK side of a docs-publishing pipeline whose architecture is SDK = content producer, Gusto/embedded-sdk-docs = versioned site host. The docs repo owns the Docusaurus site, the version archive, and the Pages publish — this PR just adds CI validation and a thin trigger.

What lands

ci.yaml — new docs-build job that runs npm run docs:build on every PR. docusaurus.config.ts has onBrokenLinks: 'throw' + onBrokenAnchors: 'throw', so broken links/anchors in docs/ fail the PR check instead of breaking releases.

docs-site/.gitignore + docs-site/package-lock.json — the lockfile was gitignored when the site was stood up in #1943. The new CI job runs npm ci in docs-site/, which requires a committed lockfile. Track it.

publish-docs.yaml (new) — fires on a successful Publish to NPM workflow run, mints a GitHub App token, and posts a repository_dispatch event of type sdk-published at Gusto/embedded-sdk-docs with payload { version, sdk_ref }. The docs repo's workflow does the work: check out SDK at sdk_ref, ingest docs/, run docusaurus docs:version $VERSION, build, publish to Pages. Lands dormant behind vars.DOCS_PUBLISH_ENABLED == 'true' so no failed-check noise.

What this PR does NOT do

  • No versioned_docs/ snapshots in this repo. Versions live in the docs repo.
  • No changes to prepare-release.yaml snapshot behavior. The release commit no longer carries a docs snapshot.
  • No Pages-publish logic in this repo. publish-docs.yaml is a thin trigger only.
  • No docs-repo workflow yet. That receiving workflow (listening for repository_dispatch type sdk-published) is a separate piece of work in Gusto/embedded-sdk-docs.

Activation runbook (separate, after merge)

  1. Provision the cross-repo publishing GitHub App; install on Gusto/embedded-sdk-docs with Contents: write (GitHub's required permission for repository_dispatch).
  2. Add repo secrets DOCS_PUBLISH_APP_ID + DOCS_PUBLISH_APP_PRIVATE_KEY to this repo.
  3. Implement the receiving workflow in Gusto/embedded-sdk-docs that listens for repository_dispatch type sdk-published.
  4. Add repo variable DOCS_PUBLISH_ENABLED=true to this repo.

Test plan

  • CI docs-build job passes on this PR (proved by the prior pass on d5ec891a).
  • Eyeball publish-docs.yaml — its first real exercise will be the next NPM publish after activation. Until then it's gated off.
  • After activation + docs-repo workflow exists, workflow_dispatch Publish Docs once to verify the App token + dispatch path end-to-end.

History

PR went through one architectural change mid-review:

  • f5e7ad5d initially landed versioned_docs/version-0.46.3/ + snapshot-on-release + static-output push to docs repo gh-pages.
  • 4e2d5453 reversed course: versions and publish belong in the docs repo, not here. This is the final architecture.

🤖 Generated with Claude Code

jeffredodd and others added 3 commits June 1, 2026 15:28
Adds the release-snapshot + post-NPM-publish bits that pair with the
Docusaurus site stood up in #1943:

- ci.yaml: docs-build job validates the site compiles (onBrokenLinks /
  onBrokenAnchors: throw) at PR time rather than at release time.
- prepare-release.yaml: snapshots docs for the released version via
  docusaurus docs:version and folds the snapshot into the release commit
  (idempotent so workflow reruns on the same release PR are safe).
- publish-docs.yaml: fires on successful Publish to NPM; builds the site
  and pushes it to Gusto/embedded-sdk-docs gh-pages. Gated on the repo
  variable DOCS_PUBLISH_ENABLED so it lands dormant; activation runbook
  (GitHub App install, secrets, var, Pages enablement) is in the file
  header.
- docusaurus.config.ts: points url at the obfuscated *.pages.github.io
  subdomain GitHub auto-assigns to internal repos as an interim home;
  swap to https://sdk.gusto.com when SDK-831 provisions the custom
  domain.
- docs-site/versions.json + versioned_{docs,sidebars}/version-0.46.3:
  one-time bootstrap of the version dropdown at the currently released
  version. Subsequent releases self-snapshot via prepare-release.yaml.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The new docs-build / prepare-release / publish-docs workflows all run
`npm ci` in docs-site/, which requires a committed lockfile. The site
was stood up in #1943 with package-lock.json gitignored, so CI failed
with EUSAGE on the first PR exercise of docs-build.

Remove the gitignore line and commit the current lockfile.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Reverses course on the SDK-owns-versioning approach in the prior
commits of this PR. Versions and the public site now live in
Gusto/embedded-sdk-docs; this repo is just the content producer.

Why: snapshotting docs into this repo on every release would accrete
a full copy of docs/ per version in git history, forever. The docs
repo is the natural home for the version archive.

- docs-site/versioned_docs, versioned_sidebars, versions.json: removed.
  Including the .gitkeep placeholders from #1943 — without versioning
  there's no reason for those directories to exist here at all.
- docusaurus.config.ts: revert url to http://localhost and drop
  trailingSlash. The SDK-side docs-site is now strictly a local-dev
  preview of current docs; the public site (with its production URL
  and trailing-slash rules) lives in the docs repo.
- prepare-release.yaml: drop the snapshot + amend steps. No docs
  snapshot in the release commit.
- publish-docs.yaml: rewrite to fire a repository_dispatch event of
  type sdk-published on Gusto/embedded-sdk-docs with payload
  { version, sdk_ref }. The docs repo's workflow checks out the SDK
  at sdk_ref, ingests docs/, runs docusaurus docs:version $VERSION,
  builds, and publishes to Pages. The publish-docs job in this repo
  no longer builds or hosts anything — it's a thin trigger.

Activation runbook updated: the publishing GitHub App now needs
Contents:write on the docs repo (GitHub's required permission for
repository_dispatch), not write access to gh-pages. The receiving
workflow on the docs repo is a separate piece of work.

The docs-build CI job and the docs-site/package-lock.json fix from
earlier commits in this PR are unchanged — both are still useful for
SDK-side validation of current docs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jeffredodd jeffredodd changed the title ci: complete Docusaurus publishing pipeline ci: docs-build PR validation + cross-repo publish dispatch Jun 1, 2026
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.

1 participant