feat: add GitHub Action for deployment notifications via ntfy and Gmail SMTP
This commit is contained in:
29
notify.sh
Normal file
29
notify.sh
Normal 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
|
||||
Reference in New Issue
Block a user