name: Deploy to LXC on: push: branches: [main] jobs: deploy: runs-on: ubuntu-latest steps: - name: Deploy via SSH uses: appleboy/ssh-action@v1 with: host: ${{ secrets.DEPLOY_HOST }} username: ${{ secrets.DEPLOY_USER }} key: ${{ secrets.DEPLOY_KEY }} port: ${{ secrets.DEPLOY_PORT || 22 }} script: | set -e cd ${{ secrets.DEPLOY_PATH || '/home/bflr/buildfor_life_repair' }} echo "==> Pulling latest code..." git pull origin main echo "==> Installing dependencies..." npm ci --production=false echo "==> Building..." npm run build echo "==> Running migrations..." npm run db:push echo "==> Restarting service..." sudo systemctl restart bflr echo "==> Waiting for startup..." sleep 2 systemctl is-active --quiet bflr && echo "Deploy successful!" || (echo "Service failed to start!" && exit 1)