From 6fdba29870c032e6456ebc9768a822b171a39da0 Mon Sep 17 00:00:00 2001 From: juanatsap Date: Wed, 20 May 2026 18:48:36 +0100 Subject: [PATCH] ci: simplify deploy workflow for host-mode runner --- .gitea/workflows/deploy.yml | 66 ++----------------------------------- 1 file changed, 3 insertions(+), 63 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index ef619ca..c8d8aff 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -7,69 +7,9 @@ on: jobs: deploy: - name: Pull and Restart + name: Deploy to VPS runs-on: ubuntu-latest steps: - - name: Deploy to VPS - run: | - 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 + - name: Deploy via SSH + 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"