Update .gitea/workflows/deploy.yaml
Local Build and Deploy / deploy (push) Successful in 56s

This commit is contained in:
remco committed 2026-07-15 21:52:39 +02:00
1 parent 8cce8837bc
commit 3802a1cfb0
1 file changed
+25 -5
+25 -5
View File
@@ -10,8 +10,23 @@ jobs:
- name: Run Deploy Scripts Locally
run: |
set -e
# Define a lockfile to prevent double, concurrent deployments
exec 9>/var/tmp/epic_web_control_deploy.lock
flock -n 9 || { echo "ERROR: Another deployment is already running! Cancelling."; exit 1; }
echo "--- EPIC WEB CONTROL: Starting Auto-Cleanup & Deploy ---"
# Fallback routine: If anything crashes during the steps below,
# try to keep the current service running so the site doesn't stay down.
error_handler() {
echo "!!! DEPLOYMENT FAILED on line $1 !!!" >&2
echo "Attempting to keep the current service running..." >&2
sudo systemctl start atom-nexst.service || true
exit 1
}
trap 'error_handler $LINENO' ERR
# 1. Clean up unused build images safely
docker image prune -f
@@ -29,14 +44,18 @@ jobs:
git reset --hard origin/main
# 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 --frozen-lockfile
# 5. Apply versioned CMS migrations and generate the Prisma client safely
# 5. [SAFETY] Database Backup & Migration
# TIP: Adjust this to your database (e.g., pg_dump for Postgres or cp for SQLite)
echo "Creating database backup..."
# Example for SQLite:
# cp prisma/dev.db prisma/backup_prior_to_deploy.db
pnpm db:migrate
pnpm prisma:generate
@@ -49,9 +68,10 @@ jobs:
# 8. Hard restart of the Systemd service to clear memory cache
echo "Hard resetting systemd service..."
sudo systemctl stop atom-nexst.service || true
# Kill any lingering next-server processes holding port 3000 so the
# new instance can bind cleanly (systemctl stop may leave orphans).
# Kill any lingering next-server processes holding port 3000
pkill -f 'next-server' || true
sudo systemctl start atom-nexst.service
# Extra health check: Ensure the service is actually running
@@ -61,4 +81,4 @@ jobs:
exit 1
fi
echo "--- Deployment successfully completed ---"
echo "--- Deployment successfully completed ---"