fix(deploy): remove standalone logic, fix chown errors in workspace
Deploy / release (push) Skipped
Deploy / deploy (push) Successful in 2m10s

- Remove standalone static file verification (no longer needed)
- Make chown commands tolerate already-deleted temp files
- Update PM2 fallback to use pnpm start
This commit is contained in:
openhands committed 2026-07-24 14:01:30 +02:00
1 parent 3773c6cb29
commit e8ade7afa3
1 file changed
+3 -13
+3 -13
View File
@@ -252,7 +252,7 @@ jobs:
if [ -n "${STAGE}" ] && [ -d "${STAGE}" ]; then
git -C "${LIVE}" worktree remove --force "${STAGE}" 2>/dev/null || rm -rf "${STAGE}" || true
fi
pm2 start next --update-env 2>/dev/null || pm2 restart next --update-env 2>/dev/null || true
pm2 restart next --update-env 2>/dev/null || pm2 start pnpm --name "next" -- start 2>/dev/null || true
exit 1
}
trap 'error_handler $LINENO' ERR
@@ -261,7 +261,7 @@ jobs:
DEPLOY_USER="$(id -un)"
DEPLOY_GROUP="$(id -gn)"
sudo chown -R "${DEPLOY_USER}:${DEPLOY_GROUP}" "${LIVE}"
sudo chown -R "${DEPLOY_USER}:${DEPLOY_GROUP}" "${LIVE}" 2>/dev/null || true
git config --global --add safe.directory "${LIVE}"
git -C "${LIVE}" remote set-url origin /docker/gitea/gitea/git/repositories/remco/epicnext-cms.git/
@@ -325,16 +325,6 @@ jobs:
echo "ERROR: stage build produced no .next/" >&2
exit 1
fi
# Verify standalone static files exist (required by Next.js standalone mode).
STANDALONE_STATIC="${STAGE}/.next/standalone/.next/static"
if [ -d "${STANDALONE_STATIC}" ] && [ -z "$(ls -A "${STANDALONE_STATIC}" 2>/dev/null)" ]; then
echo "WARNING: standalone .next/static is empty — copying fresh..."
cp -r "${STAGE}/.next/static/." "${STANDALONE_STATIC}/"
elif [ ! -d "${STANDALONE_STATIC}" ]; then
echo "WARNING: standalone static dir missing — creating..."
mkdir -p "${STANDALONE_STATIC}"
cp -r "${STAGE}/.next/static/." "${STANDALONE_STATIC}/"
fi
echo "Cutover: stop service (free DB connections), migrate, swap .next..."
CUTOVER_STARTED=1
@@ -387,7 +377,7 @@ jobs:
# Prisma client is gitignored — regenerate into live src/generated.
pnpm prisma:generate
sudo chown -R www-data:www-data "${LIVE}"
sudo chown -R www-data:www-data "${LIVE}" 2>/dev/null || true
echo "Starting PM2 (zero-downtime reload)..."
pm2 reload next --update-env || pm2 start next --update-env