Fix CI: scope NODE_ENV=production to the build step only
CI / test (push) Failing after 1m24s

Setting it job-wide made `npm ci` treat NODE_ENV=production as an
implicit --omit=dev, silently skipping eslint/typescript/test
devDependencies and failing Lint with "eslint: not found".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-25 23:43:12 +02:00
co-authored by Claude Sonnet 5
parent 0cb99243c7
commit bd38781502
2 changed files with 12 additions and 2 deletions
+6 -1
View File
@@ -14,8 +14,11 @@ jobs:
# app is force-dynamic, so `next build` never touches Postgres. These # app is force-dynamic, so `next build` never touches Postgres. These
# are dummy values only so a real config error (a missing secret) is # are dummy values only so a real config error (a missing secret) is
# never silently masked by CI happening to run without one. # never silently masked by CI happening to run without one.
#
# NODE_ENV is deliberately NOT set here: `npm ci` treats a production
# NODE_ENV as `--omit=dev`, which would skip eslint/typescript/etc. and
# break Lint/Typecheck/Test. It's set below, scoped to the Build step.
env: env:
NODE_ENV: production
NEXT_TELEMETRY_DISABLED: "1" NEXT_TELEMETRY_DISABLED: "1"
DATABASE_URI: postgresql://ci:ci@localhost:5432/ci DATABASE_URI: postgresql://ci:ci@localhost:5432/ci
PAYLOAD_SECRET: ci-only-not-a-real-secret PAYLOAD_SECRET: ci-only-not-a-real-secret
@@ -42,4 +45,6 @@ jobs:
run: npm test run: npm test
- name: Build - name: Build
env:
NODE_ENV: production
run: npm run build run: npm run build
+6 -1
View File
@@ -10,8 +10,11 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: node:22-alpine image: node:22-alpine
# NODE_ENV is deliberately NOT set at job level: `npm ci` treats a
# production NODE_ENV as `--omit=dev`, which would skip eslint/
# typescript/etc. and break Lint/Typecheck/Test. It's scoped to the
# Build step below instead.
env: env:
NODE_ENV: production
NEXT_TELEMETRY_DISABLED: "1" NEXT_TELEMETRY_DISABLED: "1"
DATABASE_URI: postgresql://ci:ci@localhost:5432/ci DATABASE_URI: postgresql://ci:ci@localhost:5432/ci
PAYLOAD_SECRET: ci-only-not-a-real-secret PAYLOAD_SECRET: ci-only-not-a-real-secret
@@ -26,6 +29,8 @@ jobs:
- run: npx tsc --noEmit - run: npx tsc --noEmit
- run: npm test - run: npm test
- run: npm run build - run: npm run build
env:
NODE_ENV: production
build-and-deploy: build-and-deploy:
needs: test needs: test