ci: simplify deploy workflow for host-mode runner
Deploy CV Server / Deploy to VPS (push) Successful in 18s
Deploy CV Server / Deploy to VPS (push) Successful in 18s
This commit is contained in:
@@ -7,69 +7,9 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
name: Pull and Restart
|
name: Deploy to VPS
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Deploy to VPS
|
- name: Deploy via SSH
|
||||||
run: |
|
run: ssh -o StrictHostKeyChecking=no txeo@172.233.115.81 "cd /home/txeo/Git/yo/cv && sudo chown -R txeo:txeo . && git clean -fd && git remote set-url origin https://repos.txeo.club/txeo/cv-site.git && git pull origin main && sudo cp config/systemd/cv.service /etc/systemd/system/cv.service && sudo systemctl daemon-reload && sudo systemctl restart cv && sleep 3 && curl -sf http://localhost:1999/health && echo DEPLOY_OK"
|
||||||
ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa txeo@172.233.115.81 << 'DEPLOY'
|
|
||||||
set -e
|
|
||||||
|
|
||||||
echo "🚀 Deploying cv-site..."
|
|
||||||
cd /home/txeo/Git/yo/cv
|
|
||||||
|
|
||||||
echo "🔧 Fixing permissions..."
|
|
||||||
sudo chown -R $USER:$USER .
|
|
||||||
|
|
||||||
if ! git diff-files --quiet || ! git diff-index --quiet --cached HEAD; then
|
|
||||||
echo "💾 Stashing local changes..."
|
|
||||||
git stash push -m "Auto-stash $(date +%Y%m%d-%H%M%S)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "🧹 Cleaning..."
|
|
||||||
git clean -fd
|
|
||||||
|
|
||||||
echo "📥 Pulling..."
|
|
||||||
git remote set-url origin https://repos.txeo.club/txeo/cv-site.git
|
|
||||||
git pull origin main
|
|
||||||
|
|
||||||
echo "🎨 Building CSS..."
|
|
||||||
if command -v lightningcss &> /dev/null; then
|
|
||||||
mkdir -p static/dist
|
|
||||||
lightningcss --bundle --minify static/css/main.css -o static/dist/bundle.min.css
|
|
||||||
echo "✅ CSS bundle created"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "📋 Updating systemd..."
|
|
||||||
sudo cp config/systemd/cv.service /etc/systemd/system/cv.service
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
|
|
||||||
echo "🔄 Restarting..."
|
|
||||||
sudo systemctl stop cv || true
|
|
||||||
for i in $(seq 1 15); do
|
|
||||||
if ! sudo fuser 1999/tcp >/dev/null 2>&1; then break; fi
|
|
||||||
[ $i -eq 15 ] && sudo fuser -k 1999/tcp 2>/dev/null || true
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
sudo systemctl start cv
|
|
||||||
sleep 3
|
|
||||||
|
|
||||||
if sudo systemctl is-active --quiet cv; then
|
|
||||||
echo "✅ Service running"
|
|
||||||
else
|
|
||||||
echo "❌ Service failed"
|
|
||||||
sudo journalctl -u cv -n 20 --no-pager
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
DEPLOY
|
|
||||||
|
|
||||||
- name: Health check
|
|
||||||
run: |
|
|
||||||
sleep 2
|
|
||||||
if curl -sf http://172.233.115.81:1999/health > /dev/null 2>&1; then
|
|
||||||
echo "✅ Health check passed"
|
|
||||||
else
|
|
||||||
echo "❌ Health check failed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|||||||
Reference in New Issue
Block a user