Skip to content

fix(ci): always use full production build in CI workflows#7510

Merged
leecalcote merged 3 commits intomasterfrom
fix/blog-ci-always-full-build
Mar 13, 2026
Merged

fix(ci): always use full production build in CI workflows#7510
leecalcote merged 3 commits intomasterfrom
fix/blog-ci-always-full-build

Conversation

@leecalcote
Copy link
Copy Markdown
Member

Root Cause

The build-and-deploy-site.yml and build-and-preview-site.yml workflows were calling make clean. The clean Makefile target is a developer convenience command whose recipe has changed multiple times, each time breaking production:

Period make clean ran Result
Before PR #7508 gatsby clean && make sitegatsby develop:lite Lite build excludes blog, news, events, resources — all posts disappeared from deployed site
Same period (after commit 22c47cf3a) gatsby clean failed with /bin/sh: gatsby: not found CI error — no build, no deploy
After PR #7508 npm run clean && make build Full build — works, but still depends on fragile Makefile chain

Every time make clean was changed for local dev ergonomics, it silently broke CI.

Fix

Call npm run build directly in both workflow files. This script is defined in package.json as:

cross-env BUILD_FULL_SITE=true gatsby build

It is the canonical, stable production build command that:

  • Always sets BUILD_FULL_SITE=true so all collections are included (blog, news, events, resources, members, integrations)
  • Never runs a development server that hangs CI
  • Is not subject to Makefile target refactoring

Also adds a comment to the Makefile clean target to mark it as developer-only, preventing future confusion about using it in CI.

Test plan

  • Verify that the next push to master triggers a full production build (1298 pages, 108+ blog pages) rather than a lite build
  • Confirm /blog shows all published posts including 2024 and 2025 entries after deployment
  • Confirm /resources still works as expected

… full site build

The deploy and preview CI workflows were calling `make clean`, a developer
convenience Makefile target whose recipe has changed several times:
- Previously ran `gatsby clean && make site` which launched `gatsby develop:lite`
  (a lite/dev build that EXCLUDES blog, news, events, and resources collections)
  or failed with "gatsby: not found" because gatsby is not globally installed in CI.
- Was later patched to `npm run clean && make build`, but this dependency on
  a mutable Makefile target is fragile and has already caused multiple production
  outages where blog posts (and other collections) were missing from the site.

Fix: call `npm run build` directly in both workflow files.
`npm run build` is defined in package.json as:
  cross-env BUILD_FULL_SITE=true gatsby build
This is the canonical, stable production build command and always includes
all collections. It cannot be accidentally changed to a lite build.

Also clarifies the Makefile `clean` target comment to note it is for local
developer use only; CI should not rely on it.
Copilot AI review requested due to automatic review settings March 13, 2026 21:21
@leecalcote leecalcote merged commit 748471f into master Mar 13, 2026
3 of 4 checks passed
@leecalcote leecalcote deleted the fix/blog-ci-always-full-build branch March 13, 2026 21:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates CI workflows to always run the canonical full production Gatsby build (npm run build) instead of relying on the mutable make clean target, preventing accidental “lite/dev” builds and missing collections in deployed output.

Changes:

  • Replaces make clean with npm run build in preview and deploy GitHub Actions workflows.
  • Splits “Install and Build” into separate install/build steps and documents why.
  • Adds a Makefile comment clarifying clean is developer-only and CI should call npm run build.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
Makefile Clarifies intent of the clean target to discourage CI usage.
.github/workflows/build-and-preview-site.yml Runs npm run build explicitly for full production build in preview workflow.
.github/workflows/build-and-deploy-site.yml Runs npm run build explicitly for full production build in deploy workflow.

Comment thread Makefile

## Empty build cache and run layer5.io on your local machine.
clean:
## Empty build cache and rebuild layer5.io on your local machine (developer use only; CI uses `npm run build` directly).
Comment on lines +21 to +27
# Always run the full production build explicitly.
# Do NOT use `make clean` here — that target is a developer convenience
# command whose recipe has changed multiple times, causing blog posts and
# other collections to be silently excluded from the deployed site when
# it ran a lite/dev build instead of the full production build.
# `npm run build` is the canonical, stable production build command:
# cross-env BUILD_FULL_SITE=true gatsby build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants