name: Deploy to Production on: push: branches: - main jobs: deploy: runs-on: self-hosted steps: - name: Pull latest code run: | cd /opt/hotelsync/app git fetch http://golomazov:Jbs5%40TikW@localhost:3001/golomazov/hotelsync.git main git reset --hard FETCH_HEAD echo "✅ Code updated" - name: Copy env run: cp /opt/hotelsync/.env /opt/hotelsync/app/.env - name: Build Docker image run: | cd /opt/hotelsync/app docker build -t hotelsync-frontend:latest . echo "✅ Image built" - name: Restart frontend container run: | docker stop hotelsync-frontend 2>/dev/null || true docker rm hotelsync-frontend 2>/dev/null || true docker run -d \ --name hotelsync-frontend \ --network hotelsync_hotelsync-net \ --restart unless-stopped \ hotelsync-frontend:latest echo "✅ Container started" - name: Health check run: | sleep 3 curl -sf http://localhost/ > /dev/null && echo "✅ App is alive!" || echo "⚠️ Check app manually"