From 23fad2dc8de7787df0a786fc9a2b5762fd7b0e7d Mon Sep 17 00:00:00 2001 From: Dominik <48656177+agresdominik@users.noreply.github.com> Date: Sat, 1 Nov 2025 23:06:28 +0100 Subject: [PATCH] Add GitHub Actions workflow for VPS deployment --- .github/workflows/main.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..bbf431d --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,35 @@ +name: Deploy Changes to VPS + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Deploy to VPS + uses: appleboy/ssh-action@v0.1.9 + with: + host: ${{ secrets.VPS_HOST }} + username: agres + key: ${{ secrets.VPS_SSH_KEY }} + port: 22 + script: | + # Pull latest changes + cd /home/agres/website + git pull origin main + + # Copy compiled Hugo site to web root + sudo rsync -av --delete --no-group --no-owner /home/agres/website/blog/public/ /var/www/html/ + + # Fix permissions + sudo chown -R www-data:www-data /var/www/html + + # Reload Nginx + sudo systemctl reload nginx