Skip to content
kode-bloxPublic

About

Builds documentation website based on markdown docs

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

20 Commits

Folders and files

Repository files navigation

KodeBlox

One Next.js and Fumadocs app builds a standalone docs site for each project. Each project owns its Markdown, sidebar metadata, and public assets.

Site DOCS_SITE
GOLFS Docs golfs
KFlared Docs kflared
AutoDidact Docs autodidact

Local development

Use npm and the Node.js version in .nvmrc. For npm run dev, copy docs.local.example.json to docs.local.json in the website root and set each profile to the path of that project's docs/ directory. Paths may be absolute or relative to the website root. Only the selected profile needs a path. Git ignores docs.local.json.

Copy-Item docs.local.example.json docs.local.json

Set DOCS_SITE in your shell, IDE run configuration, or root .env.local file. For example, put DOCS_SITE=golfs in .env.local.

npm ci
npm run dev

Open the local URL printed by Next. To run several profiles at once, set a different DOCS_SITE in each terminal and run npm run dev. With no port configured, Next chooses an available port starting at 3000. Each profile has its own dev output and Fumadocs index, and edits to shared code update all active profiles.

npm run dev copies the selected project's docs/ into the ignored content/<profile>/ directory in the website checkout. You can browse the copied Markdown, MDX, and assets there in your editor. Restart the dev server to refresh the copy after changing the source project docs.

Keep Markdown, MDX, and meta.json directly under the project's docs/, with subdirectories for nested pages. Keep static assets in docs/public/.

Use root-relative URLs such as /architecture for links between published docs pages. The same URLs work in the rendered site and the served Markdown export.

Type checking and static exports use docs.local.json when it exists and fall back to docs.prod.json when it is absent. The tracked defaults match the checkout layout used by CI and Docker. Both commands copy the selected docs into the ignored .source/build-<profile>/ directory. Next links the ignored root public/ directory to that copy's assets. Run these commands for one build profile at a time.

npm run lint
npm run types:check
npm run build
npm start

npm start serves the latest static export from out/. Each build replaces that export with the selected site's output.

CI and delivery

The CI/CD pipeline validates the selected sites independently. A shared website build or delivery change selects all three. Run workflow selects one environment or all directly.

The build stage checks formatting, lint, types, and the static export for each selected site. Normal website and manual runs check out the project's default branch. A source dispatch checks out its after commit. Pushes, source dispatches, and manual runs from main publish after all selected builds pass, using the exact docs commit each build checked out. Each image goes to ghcr.io/kode-blox/website/<site> with the tag build-<website-sha>-<docs-sha>. Landscape updates start after all selected images publish successfully. Delivery completes at the GitOps commit.

Publishing queues by site. Landscape tag updates share a queue across website runs. The queues order jobs by when they arrive, so an older run can reach Deploy after a newer one. Other repositories have their own GitHub Actions queues.

Set GITOPS_APP_CLIENT_ID as a repository variable and GITOPS_APP_PRIVATE_KEY as a repository secret.

Set the repository variable GITOPS_ENVIRONMENT_PREFIX to hetzner-fsn1-dc4-prod. Deploy appends /docs to select the Landscape environment and uses the selected GitHub Environment name as the chart name.

Configure the following GitHub Environments with main as the deployment branch.

Environment SITE_URL SITE_TITLE SITE_DESCRIPTION
golfs https://golfs.kodeblox.com GOLFS Docs Documentation for the GOLFS Git LFS server
kflared https://kflared.kodeblox.com KFlared Docs Documentation for the KFlared Cloudflare Tunnel controller
autodidact https://autodidact.kodeblox.com AutoDidact Docs Documentation for the AutoDidact course reader

Source repository dispatch

The source-side workflow notifies the website on pushes to the project's default branch that match docs/**. The website workflow must be present on its default branch, main. Send a repository dispatch to POST /repos/kode-blox/website/dispatches with this body.

{
  "event_type": "docs-source-push",
  "client_payload": {
    "project": "golfs",
    "before": "<source push before SHA>",
    "after": "<source push after SHA>"
  }
}

Use golfs, kflared, or autodidact and the full SHAs from that push. The website compares the two commits in the corresponding canonical repo and selects the site if docs/ changed. The GitHub App installation token used to send the event needs Contents: write on the website repository.

About

Builds documentation website based on markdown docs

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Packages

Contributors

Languages