This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Production Deploy | |
| on: | |
| push: | |
| branches: ["main"] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: SSH Remote Commands | |
| uses: appleboy/ssh-action@v1.0.3 | |
| with: | |
| host: ${{ secrets.HOST }} | |
| username: ${{ secrets.USERNAME }} | |
| key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| port: 22 | |
| script: | | |
| # --- 1. SYNCHRONIZATION --- | |
| cd /root/NextVibe | |
| # Get new update | |
| git fetch origin main | |
| git reset --hard origin/main | |
| # --- 2. PYTHON (DRF + FastAPI + Celery) --- | |
| echo "Updating Python libs..." | |
| # Update modules | |
| ./backend/.venv/bin/pip install -r backend/modules.txt | |
| # Migrations | |
| ./backend/.venv/bin/python backend/NextVibeAPI/manage.py migrate | |
| echo "Restarting Backend, Celery and Fastapi Services..." | |
| sudo systemctl restart nextvibe-backend.service | |
| sudo systemctl restart nextvibe-celery-beat.service | |
| sudo systemctl restart nextvibe-celery-worker.service | |
| sudo systemctl restart nextvibe-realtime.service | |
| # --- 3. Moderation serivice --- | |
| echo "Rebuilding Go..." | |
| cd moderation_service | |
| echo "Building Go App..." | |
| /usr/local/go/bin/go build -o moderation-go main.go | |
| echo "Restarting Go Service..." | |
| sudo systemctl restart nextvibe-moderation.service | |
| echo "Restarting Nginx..." | |
| sudo systemctl restart nginx.service | |
| echo "DEPLOYMENT SUCCESSFUL 🚀" |