This commit is contained in:
@@ -34,19 +34,27 @@ jobs:
|
|||||||
- name: Clean up old images
|
- name: Clean up old images
|
||||||
run: docker image prune -f
|
run: docker image prune -f
|
||||||
|
|
||||||
# Email notification using curl (Gmail SMTP)
|
- name: Set Discord mention
|
||||||
- name: Send success email
|
id: discord
|
||||||
|
run: |
|
||||||
|
echo "mention=<@${{ secrets.DISCORD_ID_RAGHU }}>" >> $GITEA_OUTPUT
|
||||||
|
|
||||||
|
# ✅ Success notification
|
||||||
|
- name: Discord Success Notification
|
||||||
if: success()
|
if: success()
|
||||||
run: |
|
run: |
|
||||||
cat > /tmp/email.txt << 'ENDMAIL'
|
curl -X POST -H "Content-Type: application/json" \
|
||||||
From: GitHub Actions
|
-d "{
|
||||||
To: raghu6004@gmail.com
|
\"content\": \"✅ **Deployment SUCCESS**\n👤 ${{ steps.discord.outputs.mention }}\n📦 Repo: ${{ gitea.repository }}\n🌿 Branch: ${{ gitea.ref_name }}\"
|
||||||
Subject: Deployment Successful - Portfolio
|
}" \
|
||||||
|
${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||||
|
|
||||||
Deployment completed successfully!
|
# ❌ Failure notification
|
||||||
Repository: ${{ github.repository }}
|
- name: Discord Failure Notification
|
||||||
Branch: ${{ github.ref_name }}
|
if: failure()
|
||||||
Commit: ${{ github.sha }}
|
run: |
|
||||||
ENDMAIL
|
curl -X POST -H "Content-Type: application/json" \
|
||||||
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
|
-d "{
|
||||||
rm /tmp/email.txt
|
\"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