feat: add send push on like #39
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: | | |
| # --- 0. PREPARE ENVIRONMENT --- | |
| cd /root/NextVibe | |
| git config --global --add safe.directory /root/NextVibe | |
| # --- 1. STOP CRITICAL SERVICES --- | |
| sudo systemctl stop nextvibe-moderation.service | |
| # --- 2. HARD RESET (Nuclear Option) --- | |
| echo "🔥 Forcing Git state..." | |
| git fetch --all | |
| git checkout main | |
| git reset --hard origin/main | |
| git clean -fd | |
| git pull origin main | |
| # --- 3. PYTHON UPDATE --- | |
| echo "🐍 Updating Python..." | |
| ./backend/.venv/bin/pip install -r backend/modules.txt | |
| ./backend/.venv/bin/python backend/NextVibeAPI/manage.py migrate | |
| ./backend/.venv/bin/python backend/NextVibeAPI/manage.py collectstatic --noinput | |
| # --- 4. GO REBUILD --- | |
| echo "🐹 Rebuilding Go..." | |
| cd moderation_service | |
| rm -f moderator_bin | |
| go build -o moderator_bin . | |
| cd .. | |
| # --- 5. NFT SERVICE UPDATE --- | |
| echo "🦊 Updating NFT service..." | |
| cd nft-service | |
| bun install | |
| cd .. | |
| # --- 6. RESTART ALL --- | |
| echo "🔄 Restarting Services..." | |
| sudo systemctl restart nextvibe-backend.service | |
| sudo systemctl restart nextvibe-realtime.service | |
| sudo systemctl restart nextvibe-celery-beat.service | |
| sudo systemctl restart nextvibe-celery-worker.service | |
| sudo systemctl start nextvibe-moderation.service | |
| sudo systemctl restart nextvibe-nft.service | |
| sudo systemctl reload nginx | |
| echo "✅ DEPLOYMENT FINISHED SUCCESSFULLY" |