name: Deploy to Dev Server

on:
  push:
    branches: [ main ]

jobs:
  deploy:
    runs-on: ubuntu-latest
    
    steps:
      - name: Deploy via SSH
        uses: appleboy/ssh-action@master
        with:
          host: ${{ secrets.DEV_SERVER_HOST }}
          username: ${{ secrets.DEV_SERVER_USER }}
          password: ${{ secrets.DEV_SERVER_PASSWORD }}
          script: |
            cd /home/tom/lub/website
            git pull origin main
            docker compose down
            docker compose up -d --build
            docker system prune -f