feat: add GitHub Action for deployment notifications via ntfy and Gmail SMTP

This commit is contained in:
2025-12-29 15:53:40 +07:00
commit 982e814a0f
2 changed files with 81 additions and 0 deletions

29
notify.sh Normal file
View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -e
ICON="🚀"
if [ "$STATUS" = "failure" ]; then
ICON="❌"
fi
# ---- ntfy ----
if [ -n "$NTFY_URL" ] && [ -n "$NTFY_TOPIC" ]; then
curl -s -X POST "$NTFY_URL/$NTFY_TOPIC" \
-H "Title: $ICON $TITLE" \
-H "Priority: 4" \
-d "$MESSAGE"
fi
# ---- Gmail SMTP ----
if [ -n "$GMAIL_USER" ] && [ -n "$GMAIL_TO" ]; then
{
echo "Subject: $ICON $TITLE"
echo "From: $GMAIL_USER"
echo "To: $GMAIL_TO"
echo ""
echo "$MESSAGE"
} | sendmail -S smtp.gmail.com:587 \
-au"$GMAIL_USER" \
-ap"$GMAIL_PASS" \
"$GMAIL_TO"
fi