Skip to content

Pull blueprints at build time; drop the live branch deploy path - #5694

Draft
ZJvandeWeg wants to merge 2 commits into
mainfrom
zj-blueprints-build-time-fetch
Draft

Pull blueprints at build time; drop the live branch deploy path#5694
ZJvandeWeg wants to merge 2 commits into
mainfrom
zj-blueprints-build-time-fetch

Conversation

@ZJvandeWeg

@ZJvandeWeg ZJvandeWeg commented Aug 27, 2026

Copy link
Copy Markdown
Member

Summary

Blueprints were previously fetched by the Build Site Actions workflow, committed onto a force-pushed live branch, and Netlify watched that branch for production deploys. Product docs already resolve at build time (nuxt/lib/docs-sync.mjs); this applies the same pattern to blueprints so Netlify can build straight from main, and the live branch can go away.

This ships as two logical steps:

  1. Pull blueprints at build time. nuxt/lib/blueprints-sync.mjs resolves FlowFuse/blueprint-library the same local → sibling → clone precedence as docs, writing into src/blueprints. blueprint-library is private (unlike the public flowfuse/flowfuse docs source), so the clone step authenticates with a GitHub App installation token (nuxt/lib/github-app-token.mjs, via @octokit/auth-app) minted from the existing GH_BOT_APP_ID/GH_BOT_APP_KEY credentials, instead of cloning anonymously.
  2. Remove the live branch requirement. .github/workflows/build.yml no longer checks out blueprint-library, commits, or force-pushes to live — it's now a thin trigger that hits a Netlify build hook. It's kept (not deleted) because flowfuse/flowfuse's Publish Documentation workflow dispatches it by name after a docs PR merges to trigger a website rebuild, and it also runs on the existing cron schedule to pick up blueprint-library changes — neither of those pushes anything to this repo, so Netlify wouldn't otherwise notice.

Manual setup required before live can be retired

This PR is the code side only. None of it takes effect in production until the following is done, in order:

  1. Add Netlify env vars GH_BOT_APP_ID and GH_BOT_APP_KEY — same values as the existing GitHub Actions secrets of the same name. This is what lets Netlify's build clone the private blueprint-library repo.
  2. DONE ZJ: Add the build hook Netlify URL as a NETLIFY_BUILD_HOOK secret in this GitHub repo
  3. Switch Netlify's production branch from live to main in site settings. Post-merge this is
  4. Verify a production deploy from main actually renders blueprints correctly (image paths, flow.json passthrough, etc.) before relying on it.
  5. Delete the live branch once step 4 is confirmed working.

GH_BOT_APP_ID/GH_BOT_APP_KEY are a shared org-wide GitHub App credential also used by project-automation.yml in this repo and by flowfuse/flowfuse's docs.yml — adding them as a Netlify env var is read-only reuse, it doesn't move or affect those existing usages.

Test plan

  • npm test — all 111 tests pass
  • npm run blueprints locally against the real ../blueprint-library sibling checkout — verified image: frontmatter paths, README→index renaming, and flow.json passthrough all match the previous script's output
  • Manual setup steps above completed
  • A real Netlify deploy from main (with the clone-fallback path, not the sibling path) verified to produce working blueprint pages

Blueprints were previously fetched by the "Build Site" Actions workflow,
committed onto a force-pushed `live` branch, which Netlify watched for
production deploys. Product docs already resolve at build time via
nuxt/lib/docs-sync.mjs; this applies the same pattern to blueprints so
Netlify can build straight from `main`.

- nuxt/lib/blueprints-sync.mjs: resolves FlowFuse/blueprint-library the
  same way docs-sync.mjs resolves flowfuse/flowfuse (local -> sibling ->
  clone), writing into src/blueprints. blueprint-library is private, so
  the clone step authenticates with a GitHub App installation token
  (nuxt/lib/github-app-token.mjs, via @octokit/auth-app) minted from the
  existing GH_BOT_APP_ID/GH_BOT_APP_KEY credentials, rather than cloning
  anonymously like docs does.
- scripts/copy_blueprints.mjs replaces scripts/copy_blueprints.js as a
  thin CLI entry point (ESM, mirrors scripts/sync_docs.mjs).
- .github/workflows/build.yml: dropped the blueprint-library
  checkout/commit/force-push-to-live steps. Kept as a thin trigger that
  hits a Netlify build hook, since flowfuse/flowfuse's "Publish
  Documentation" workflow dispatches this workflow by name after a docs
  PR merges, and it also covers blueprint-library changes on a schedule
  (neither pushes to this repo, so Netlify wouldn't otherwise notice).

This PR only contains the code side. Manual Netlify/GitHub setup is
still required before the live branch can be retired - see the PR
description.
@ZJvandeWeg
ZJvandeWeg requested review from a team and Yndira-E as code owners August 27, 2026 15:43
@netlify

netlify Bot commented Aug 27, 2026

Copy link
Copy Markdown

Deploy Preview for flowforge-website ready!

Name Link
🔨 Latest commit 26479dd
🔍 Latest deploy log https://app.netlify.com/projects/flowforge-website/deploys/6a907d760aac130008d0c9fe
😎 Deploy Preview https://deploy-preview-5694--flowforge-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 61 (🟢 up 14 from production)
Accessibility: 96 (no change from production)
Best Practices: 100 (no change from production)
SEO: 85 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

CI's build_website.yml checks out blueprint-library as a sibling and
calls `npm run blueprints` before `npm install` (same reason
docs-sync.mjs stays dependency-free). A static import of
github-app-token.mjs pulled in @octokit/auth-app at module-load time
regardless of which resolveSource() branch actually ran, crashing a
build that only ever takes the sibling path and never touches the
clone/token code at all.

Load it lazily inside cloneBlueprints() instead, so it's only required
when the clone path is actually reached - which only happens on
Netlify, where npm install has already completed by the time the build
command runs.
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