CI/CD: add deploy webhook endpoint for Gitea auto-deploy

This commit is contained in:
2026-03-29 13:23:07 +00:00
parent 4fae1c5a06
commit d0e464be5f
3 changed files with 133 additions and 64 deletions

26
deploy.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/bash
set -e
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
export HOME="/root"
LOG="/opt/task-team/deploy.log"
echo "=== Deploy started at $(date -Is) ===" >> $LOG
# Pull latest code
cd /opt/task-team
git pull origin master >> $LOG 2>&1
# Install deps
cd /opt/task-team/api
npm install --production >> $LOG 2>&1
# Reload API (with --force to avoid "already in progress")
pm2 reload taskteam-api --force >> $LOG 2>&1
# Build frontend (if it exists)
if [ -d /opt/task-team/apps/tasks ] && [ -f /opt/task-team/apps/tasks/package.json ]; then
cd /opt/task-team/apps/tasks
NEXT_PUBLIC_API_URL=http://localhost:3000 npm run build >> $LOG 2>&1
pm2 reload taskteam-web --force >> $LOG 2>&1 || true
fi
echo "=== Deploy completed at $(date -Is) ===" >> $LOG