CI/CD: add deploy webhook endpoint for Gitea auto-deploy
This commit is contained in:
26
deploy.sh
Executable file
26
deploy.sh
Executable 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
|
||||
Reference in New Issue
Block a user