From dae381e07cfb15dbe99a3e053f00cbf9496d2f18 Mon Sep 17 00:00:00 2001 From: openhands Date: Thu, 23 Jul 2026 19:33:12 +0200 Subject: [PATCH] Persist .next/cache across deploys for faster rebuilds Each deploy creates a fresh worktree and deletes .next, losing the Turbopack build cache. Now restore .next/cache from the live site into the stage before pnpm build, so Next.js can do incremental compilation. After cutover the cache persists in the live .next/ for the next deploy. --- .gitea/workflows/deploy.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index 86935aab..1d59f415 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -299,6 +299,13 @@ jobs: find . -maxdepth 3 -name '*.tsbuildinfo' -delete 2>/dev/null || true rm -rf .output dist .next .next/types .next/dev + # Restore build cache from last deploy so Turbopack can do + # incremental compilation (much faster rebuilds). + if [ -d "${LIVE}/.next/cache" ]; then + mkdir -p .next/cache + cp -r "${LIVE}/.next/cache/." .next/cache/ + fi + # Stage shares MySQL with the live app + emulator. Keep the stage pool # tiny so install/test/build cannot exhaust max_connections. export DATABASE_POOL_SIZE="${DEPLOY_DATABASE_POOL_SIZE:-5}"