Skip to content

Commit 6ab9547

Browse files
committed
Update gradle.yml
1 parent e6605cc commit 6ab9547

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

.github/workflows/gradle.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,65 @@ jobs:
106106
env:
107107
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108108

109+
- name: Send Telegram Notification
110+
if: startsWith(github.ref, 'refs/tags/v')
111+
env:
112+
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
113+
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
114+
RELEASE_TITLE: ${{ env.RELEASE_TITLE }}
115+
run: |
116+
# Read release body
117+
BODY=$(cat release-body.md)
118+
119+
# Construct HTML formatted message (Telegram supports HTML tags)
120+
if echo "$BODY" | grep -q "Support the Project"; then
121+
MESSAGE="hello everyone,
122+
123+
<b>$RELEASE_TITLE</b>
124+
125+
$BODY
126+
127+
Note: If you encounter an 'App not installed' error during installation, please uninstall the previous version before installing this update."
128+
else
129+
MESSAGE="hello everyone,
130+
131+
<b>$RELEASE_TITLE</b>
132+
133+
$BODY
134+
135+
Note: If you encounter an 'App not installed' error during installation, please uninstall the previous version before installing this update.
136+
137+
Thank you for your continued support. If you encounter any issues, please report them through the usual channels.
138+
139+
<b>Support the Project</b>
140+
If you'd like to support ongoing development, you can do so through any of the following:
141+
142+
• Buy Me a Coffee: https://buymeacoffee.com/iad1tya
143+
• GitHub Sponsors: https://github.com/sponsors/iad1tya
144+
• Support Page: https://support.iad1tya.cyou/
145+
146+
Every contribution helps support continued development, maintenance, and future improvements.
147+
148+
Thank you for your support, and enjoy the update!"
149+
fi
150+
151+
# Create JSON payload securely using jq
152+
jq -n \
153+
--arg chat_id "$TELEGRAM_CHAT_ID" \
154+
--arg text "$MESSAGE" \
155+
--arg parse_mode "HTML" \
156+
'{
157+
chat_id: $chat_id,
158+
text: $text,
159+
parse_mode: $parse_mode,
160+
disable_web_page_preview: true
161+
}' > telegram-payload.json
162+
163+
# Send message using Telegram Bot API
164+
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
165+
-H "Content-Type: application/json" \
166+
-d @telegram-payload.json
167+
109168
- name: Send Discord Notification
110169
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && !startsWith(github.ref, 'refs/tags/')
111170
env:

0 commit comments

Comments
 (0)