Fix deploy error handler: cd to safe dir before pm2
Deploy / release (push) Skipped
Deploy / deploy (push) Successful in 1m58s

This commit is contained in:
openhands committed 2026-07-23 19:16:34 +02:00
1 parent aabf14aaf9
commit b6ba554386
1 file changed
+2 -1
+2 -1
View File
@@ -241,6 +241,7 @@ jobs:
CUTOVER_STARTED=0
error_handler() {
cd /var/www/atom-nexst 2>/dev/null || cd / || true
echo "!!! DEPLOYMENT FAILED on line $1 !!!" >&2
# Roll back the build artifact if cutover already moved .next into place.
if [ "${CUTOVER_STARTED}" = "1" ] && [ -d "${LIVE}/.next.prev" ]; then
@@ -251,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 || true
pm2 start next --update-env 2>/dev/null || pm2 restart next --update-env 2>/dev/null || true
exit 1
}
trap 'error_handler $LINENO' ERR