fix(ci): migrate on tag release and wire drizzle schema generate
CI / check (push) Successful in 23s
CI / release (push) Skipped
CI / deploy (push) Successful in 1m1s

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-07-31 21:03:54 +02:00
1 parent 20b85381fe
commit 67656a9aad
5 files changed
+91

No files matched your search

+19
View File
@@ -301,8 +301,27 @@ jobs:
export NODE_ENV=production
export SKIP_ENV_VALIDATION=1
pnpm install --frozen-lockfile
# prisma generate only needs a resolvable URL — no live DB connection.
export DATABASE_URL="mysql://placeholder:please@localhost/placeholder"
pnpm prisma:generate
unset DATABASE_URL
# Tag releases must apply CMS SQL migrations against the live DB
# (same path as push-to-main deploy), using the production .env.
LIVE="/var/www/atom-nexst"
ln -sfn "${LIVE}/.env" "${WORK}/.env"
MIGRATE_OK=0
for i in $(seq 1 10); do
if pnpm db:migrate; then
MIGRATE_OK=1
break
fi
echo "migrate attempt ${i}/10 failed (likely DB connections), retrying..."
sleep 5
done
if [ "${MIGRATE_OK}" != "1" ]; then
echo "ERROR: db:migrate failed after retries" >&2
exit 1
fi
pnpm build
pm2 restart next --update-env
pm2 save