Skip to content

Commit 2092739

Browse files
committed
fix(ci): use npm run build directly in CI workflows to always produce 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.
1 parent 8997b0d commit 2092739

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

.github/workflows/build-and-deploy-site.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,18 @@ jobs:
2828
# restore-keys: |
2929
# ${{ runner.os }}-gatsby-
3030

31-
- name: Install and Build 🔧
32-
run: |
33-
make setup
34-
make clean
31+
- name: Install 🔧
32+
run: make setup
33+
34+
- name: Build 🏗️
35+
# Always run the full production build explicitly.
36+
# Do NOT use `make clean` here — that target is a developer convenience
37+
# command whose recipe has changed multiple times, causing blog posts and
38+
# other collections to be silently excluded from the deployed site when
39+
# it ran a lite/dev build instead of the full production build.
40+
# `npm run build` is the canonical, stable production build command:
41+
# cross-env BUILD_FULL_SITE=true gatsby build
42+
run: npm run build
3543

3644
- name: Deploy 🚀
3745
uses: JamesIves/github-pages-deploy-action@v4

.github/workflows/build-and-preview-site.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,18 @@ jobs:
1414
persist-credentials: false
1515
fetch-depth: 1
1616

17-
- name: Install and Build 🔧
18-
run: |
19-
make setup
20-
make clean
17+
- name: Install 🔧
18+
run: make setup
19+
20+
- name: Build 🏗️
21+
# Always run the full production build explicitly.
22+
# Do NOT use `make clean` here — that target is a developer convenience
23+
# command whose recipe has changed multiple times, causing blog posts and
24+
# other collections to be silently excluded from the deployed site when
25+
# it ran a lite/dev build instead of the full production build.
26+
# `npm run build` is the canonical, stable production build command:
27+
# cross-env BUILD_FULL_SITE=true gatsby build
28+
run: npm run build
2129

2230
- name: Broken Link Check 🔗
2331
uses: technote-space/broken-link-checker-action@v2

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ site-fast:
3939
build:
4040
npm run build
4141

42-
## Empty build cache and run layer5.io on your local machine.
43-
clean:
42+
## Empty build cache and rebuild layer5.io on your local machine (developer use only; CI uses `npm run build` directly).
43+
clean:
4444
npm run clean && make build
4545

4646
## Run Eslint on your local machine.

0 commit comments

Comments
 (0)