Skip to content

Commit

Permalink
ci: Update "debug.yml" 'Send to Telegram'
Browse files Browse the repository at this point in the history
  • Loading branch information
LiuYi0526 committed Feb 23, 2024
1 parent 280aa7c commit 65237b6
Showing 1 changed file with 17 additions and 28 deletions.
45 changes: 17 additions & 28 deletions .github/workflows/debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,9 @@ jobs:
with:
name: telegram-bot-api-binary
path: .
- name: setup python telebot
run: |
pip install telebot
- name: Send to Telegram
run: |
chmod +x telegram-bot-api-binary
Expand All @@ -421,35 +424,21 @@ jobs:
export full64nogcm=$(find artifacts -name "*full-arm64-v8aNoGcm-unsigned.apk")
export full32nogcm=$(find artifacts -name "*full-armeabi-v7aNoGcm-unsigned.apk")
echo $mini64
echo $mini32
echo $full64
echo $full32
echo $mini64nogcm
echo $mini32nogcm
echo $full64nogcm
echo $full32nogcm
touch ./Send_to_Telegram.py
sudo cat >./Send_to_Telegram.py <<EOL
import telebot
from telebot import apihelper
apihelper.API_URL = "http://localhost:8081/bot{0}/{1}"
tb = telebot.TeleBot('''${{ secrets.HELPER_BOT_TOKEN }}''')
file_paths = ("""${mini64}""", """${mini32}""", """${full64}""", """${full32}""", """${mini64nogcm}""", """${mini32nogcm}""", """${full64nogcm}""", """${full32nogcm}""")
print(file_paths)
list_captions = ("", "", "", "", "", "", "", """Test version, [${{ github.event.head_commit.message }}](${{ github.event.head_commit.url }})""")
media_group = [telebot.types.InputMediaDocument(open(file, "rb"), caption=caption, parse_mode='Markdown') for file, caption in zip(file_paths, list_captions)]
tb.send_media_group(chat_id='''${{ secrets.HELPER_BOT_TARGET }}''', media=media_group, timeout=300)
EOL
python Send_to_Telegram.py
curl --http0.9 http://127.0.0.1:8081/bot${{ secrets.HELPER_BOT_TOKEN }}/sendMediaGroup \
--form-string chat_id=${{ secrets.HELPER_BOT_TARGET }} \
--form apk1=@"${mini64}" \
--form apk2=@"${mini32}" \
--form apk3=@"${full64}" \
--form apk4=@"${full32}" \
--form apk5=@"${mini64nogcm}" \
--form apk6=@"${mini32nogcm}" \
--form apk7=@"${full64nogcm}" \
--form apk8=@"${full32nogcm}" \
--form-string media='[{"type": "document","media": "attach://apk1","caption": "","parse_mode": "Markdown"},
{"type": "document","media": "attach://apk2","caption": "","parse_mode": "Markdown"},
{"type": "document","media": "attach://apk3","caption": "","parse_mode": "Markdown"},
{"type": "document","media": "attach://apk4","caption": "","parse_mode": "Markdown"},
{"type": "document","media": "attach://apk5","caption": "","parse_mode": "Markdown"},
{"type": "document","media": "attach://apk6","caption": "","parse_mode": "Markdown"},
{"type": "document","media": "attach://apk7","caption": "","parse_mode": "Markdown"},
{"type": "document","media": "attach://apk8","caption": ${{ toJSON(format('Test version, [{0}]({1})',github.event.head_commit.message,github.event.head_commit.url))}},"parse_mode": "Markdown"}]' \
--verbose >/dev/null
pkill telegram-bot
telegram-bot-api:
name: Telegram Bot API
Expand Down

0 comments on commit 65237b6

Please sign in to comment.