This commit is contained in:
@@ -34,19 +34,27 @@ jobs:
|
||||
- name: Clean up old images
|
||||
run: docker image prune -f
|
||||
|
||||
# Email notification using curl (Gmail SMTP)
|
||||
- name: Send success email
|
||||
- name: Set Discord mention
|
||||
id: discord
|
||||
run: |
|
||||
echo "mention=<@${{ secrets.DISCORD_ID_RAGHU }}>" >> $GITEA_OUTPUT
|
||||
|
||||
# ✅ Success notification
|
||||
- name: Discord Success Notification
|
||||
if: success()
|
||||
run: |
|
||||
cat > /tmp/email.txt << 'ENDMAIL'
|
||||
From: GitHub Actions
|
||||
To: raghu6004@gmail.com
|
||||
Subject: Deployment Successful - Portfolio
|
||||
curl -X POST -H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"content\": \"✅ **Deployment SUCCESS**\n👤 ${{ steps.discord.outputs.mention }}\n📦 Repo: ${{ gitea.repository }}\n🌿 Branch: ${{ gitea.ref_name }}\"
|
||||
}" \
|
||||
${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||
|
||||
Deployment completed successfully!
|
||||
Repository: ${{ github.repository }}
|
||||
Branch: ${{ github.ref_name }}
|
||||
Commit: ${{ github.sha }}
|
||||
ENDMAIL
|
||||
curl --ssl-reqd --url smtps://smtp.gmail.com:465 --user "${{ secrets.EMAIL_USERNAME }}:${{ secrets.EMAIL_PASSWORD }}" --mail-from "${{ secrets.EMAIL_USERNAME }}" --mail-rcpt raghu6004@gmail.com --upload-file /tmp/email.txt
|
||||
rm /tmp/email.txt
|
||||
# ❌ Failure notification
|
||||
- name: Discord Failure Notification
|
||||
if: failure()
|
||||
run: |
|
||||
curl -X POST -H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"content\": \"❌ **Deployment FAILED**\n👤 ${{ steps.discord.outputs.mention }}\n📦 Repo: ${{ gitea.repository }}\n🌿 Branch: ${{ gitea.ref_name }}\n🔍 Check Gitea Actions logs\"
|
||||
}" \
|
||||
${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||
|
||||
Reference in New Issue
Block a user