Skip to content

feat: serve TechDocs from GitHub Pages via custom publisher#986

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/switch-to-github-pages-techdocs
Draft

feat: serve TechDocs from GitHub Pages via custom publisher#986
Copilot wants to merge 2 commits intomainfrom
copilot/switch-to-github-pages-techdocs

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 4, 2026

Backstage was building and rendering TechDocs locally while the same docs were already pre-built and hosted on GitHub Pages. This switches Backstage to read directly from GitHub Pages, eliminating redundant local builds while preserving search indexing.

New plugin: techdocs-backend-module-ghpages

Implements PublisherBase from @backstage/plugin-techdocs-node as a GitHub Pages proxy:

  • docsRouter() — maps /namespace/kind/name/…baseUrl/name/…, streams response
  • fetchTechDocsMetadata() — fetches techdocs_metadata.json from baseUrl/name/
  • hasDocsBeenGenerated() — HEAD-checks baseUrl/name/index.html
  • publish() — intentional no-op; builds happen in repo CI

Registered via techdocsPublisherExtensionPoint under the custom key 'githubPages'.

Config change

# app-config.yaml
techdocs:
  builder: "external"
  publisher:
    type: "githubPages"
    githubPages:
      baseUrl: "https://radiorabe.github.io"

Search indexing continues to work: the TechDocs collator reads through the same publisher.

What each repo needs to do

Documented in docs/techdocs.md and plugins/techdocs-backend-module-ghpages/README.md. In short: build with techdocs-cli generate (which produces techdocs_metadata.json alongside the HTML) and deploy the entire ./site output to gh-pages. The metadata file must be present at the root of the GitHub Pages site or Backstage cannot display the docs.

# .github/workflows/techdocs.yml (minimal)
- run: |
    npm install -g @techdocs/cli
    pip install "mkdocs-techdocs-core==1.*"
    techdocs-cli generate --no-docker
- uses: peaceiris/actions-gh-pages@v4
  with:
    github_token: ${{ secrets.GITHUB_TOKEN }}
    publish_dir: ./site        # includes techdocs_metadata.json

Entity metadata.name must match the GitHub repository name (lower-case) since the publisher maps entity name directly to the GitHub Pages path segment.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Add plugins/techdocs-backend-module-ghpages with GithubPagesPublisher
  implementing PublisherBase; proxies docs from GitHub Pages, no-op publish
- Register publisher via techdocsPublisherExtensionPoint in backend module
- Wire module into packages/backend
- Switch app-config.yaml to builder: external, publisher: githubPages
- Add docs/techdocs.md describing CI workflow repos must follow
- 11 unit tests, all passing; lint and build clean

Co-authored-by: hairmare <116588+hairmare@users.noreply.github.com>
Copilot AI changed the title [WIP] Update Backstage to use GitHub Pages hosted TechDocs feat: serve TechDocs from GitHub Pages via custom publisher Mar 4, 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.

2 participants