@@ -11,26 +11,65 @@ jobs:
1111 runs-on : ubuntu-latest
1212
1313 steps :
14- - name : Checkout repository
14+ - name : 📦 Checkout repository
1515 uses : actions/checkout@v3
1616
17- - name : Setup SSH agent
17+ - name : 🔐 Setup SSH agent
1818 uses : webfactory/ssh-agent@v0.9.0
1919 with :
2020 ssh-private-key : ${{ secrets.SSH_PRIVATE_KEY }}
2121
22- - name : Setup known_hosts
22+ - name : 🧾 Setup known_hosts
2323 run : |
2424 mkdir -p ~/.ssh
2525 echo "${{ secrets.VPS_KNOWN_HOST }}" > ~/.ssh/known_hosts
2626 chmod 644 ~/.ssh/known_hosts
2727
28- - name : Deploy
28+ - name : 🚀 Deploy to VPS
29+ id : deploy_step
2930 run : |
3031 if [ "${{ github.ref }}" = "refs/heads/main" ]; then
32+ echo "ENVIRONMENT=PRODUCTION" >> $GITHUB_ENV
3133 echo "🚀 Deploying PRODUCTION"
3234 ssh ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }} "bash /home/ubuntu/deploy-triptogether.sh"
3335 else
36+ echo "ENVIRONMENT=STAGING" >> $GITHUB_ENV
3437 echo "🧪 Deploying STAGING"
3538 ssh ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }} "bash /home/ubuntu/deploy-triptogether-staging.sh"
3639 fi
40+
41+ # ✅ SUCCESS NOTIFICATION
42+ - name : ✅ Telegram Success Notification
43+ if : success()
44+ run : |
45+ curl -s -X POST https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendMessage \
46+ -d chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
47+ -d parse_mode="HTML" \
48+ -d text="✅ <b>${{ env.ENVIRONMENT }} Deploy SUCCESS</b>
49+
50+ 📦 <b>Repo:</b> ${{ github.repository }}
51+ 🌿 <b>Branch:</b> ${{ github.ref_name }}
52+ 👤 <b>Author:</b> ${{ github.actor }}
53+ 📝 <b>Commit:</b> ${{ github.event.head_commit.message }}
54+ 🕒 <b>Date:</b> $(date -u '+%Y-%m-%d %H:%M:%S UTC')
55+
56+ 🔎 <a href='https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'>View Logs</a>"
57+
58+ # ❌ FAILURE NOTIFICATION
59+ - name : ❌ Telegram Failure Notification
60+ if : failure()
61+ run : |
62+ curl -s -X POST https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendMessage \
63+ -d chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" \
64+ -d parse_mode="HTML" \
65+ -d text="❌ <b>${{ env.ENVIRONMENT }} Deploy FAILED</b>
66+
67+ 📦 <b>Repo:</b> ${{ github.repository }}
68+ 🌿 <b>Branch:</b> ${{ github.ref_name }}
69+ 👤 <b>Author:</b> ${{ github.actor }}
70+ 📝 <b>Commit:</b> ${{ github.event.head_commit.message }}
71+ 🕒 <b>Date:</b> $(date -u '+%Y-%m-%d %H:%M:%S UTC')
72+
73+ ⚠️ <b>Check immediately.</b>
74+
75+ 🔎 <a href='https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'>View Logs</a>"
0 commit comments