diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index c370d363..6274da50 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -28,12 +28,13 @@ jobs: git fetch origin --prune git reset --hard origin/main - # REMOVE OLD CACHE AND BUILDS - rm -rf .next .output dist + # Preserve .next/cache so Next.js can reuse its incremental build cache. + # next build safely refreshes stale server/static output itself. + rm -rf .output dist # 4. Configure trusted dependencies globally and install cleanly export PNPM_CONFIG_ONLY_BUILT_DEPENDENCIES="@parcel/watcher,@swc/core,sharp" - pnpm install + pnpm install --frozen-lockfile # 5. Apply versioned CMS migrations and generate the Prisma client safely pnpm db:migrate @@ -57,4 +58,4 @@ jobs: exit 1 fi - echo "--- Deployment successfully completed ---" \ No newline at end of file + echo "--- Deployment successfully completed ---" diff --git a/src/lib/deploy-workflow-contract.test.ts b/src/lib/deploy-workflow-contract.test.ts new file mode 100644 index 00000000..dd50b4a1 --- /dev/null +++ b/src/lib/deploy-workflow-contract.test.ts @@ -0,0 +1,12 @@ +import { readFileSync } from "node:fs"; +import { resolve } from "node:path"; +import { describe, expect, it } from "vitest"; + +describe("production deploy workflow", () => { + const workflow = readFileSync(resolve(process.cwd(), ".gitea/workflows/deploy.yaml"), "utf8"); + + it("preserves the Next.js incremental build cache", () => { + expect(workflow).not.toMatch(/rm\s+-rf[^\n]*\.next/); + expect(workflow).toContain("pnpm install --frozen-lockfile"); + }); +});