Skip to content

Commit 7b3cf75

Browse files
authored
Update release.yml
1 parent 5c93940 commit 7b3cf75

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

.github/workflows/release.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,27 @@ jobs:
118118
--title "aShell You ${{ github.ref_name }}" \
119119
--notes-file changelog.txt
120120
env:
121-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122+
123+
- name: Notify Telegram of New Release
124+
env:
125+
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
126+
CHAT_ID: ${{ secrets.CHAT_ID }}
127+
THREAD_ID: ${{ secrets.RELEASE_THREAD_ID }}
128+
run: |
129+
TAG=${{ github.ref_name }}
130+
URL="https://github.com/${{ github.repository }}/releases/tag/${TAG}"
131+
132+
# Escape underscores for MarkdownV2
133+
ESC_TAG=${TAG//_/\\_}
134+
135+
TEXT="🚀 *New Release Published*\n• *${ESC_TAG}*\n🔗 [View Release](${URL})"
136+
137+
REPLY='{"inline_keyboard":[[{"text":"View Release","url":"'"$URL"'"}]]}'
138+
139+
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendMessage" \
140+
-d chat_id="$CHAT_ID" \
141+
-d parse_mode="MarkdownV2" \
142+
-d text="$TEXT" \
143+
-d reply_markup="$REPLY" \
144+
-d message_thread_id="$THREAD_ID"

0 commit comments

Comments
 (0)