Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
LiuYi0526 committed Mar 16, 2024
2 parents 1e592cf + 9dd6335 commit ead7d4e
Show file tree
Hide file tree
Showing 31 changed files with 532 additions and 298 deletions.
21 changes: 9 additions & 12 deletions .github/workflows/debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,6 @@ jobs:
flavor:
- FullRelease
- MiniRelease
- FullReleaseNoGcm
- MiniReleaseNoGcm
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -374,7 +372,6 @@ jobs:
- name: Debug Build
run: |
export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}"
export DEBUG_BUILD=true
./gradlew TMessagesProj:assemble${{ matrix.flavor }}
APK=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk')
Expand All @@ -386,8 +383,8 @@ jobs:
path: ${{ env.APK }}
upload:
name: Upload debug
if: github.event.inputs.upload != 'y'
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, 'bump version') }}
needs:
- build
- telegram-bot-api
Expand All @@ -401,6 +398,10 @@ jobs:
with:
name: telegram-bot-api-binary
path: .
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Setup Python telebot
run: |
pip install telebot
Expand All @@ -419,24 +420,20 @@ jobs:
export mini32=$(find artifacts -name "*mini-armeabi-v7a.apk")
export full64=$(find artifacts -name "*full-arm64-v8a.apk")
export full32=$(find artifacts -name "*full-armeabi-v7a.apk")
export mini64nogcm=$(find artifacts -name "*mini-arm64-v8aNoGcm.apk")
export mini32nogcm=$(find artifacts -name "*mini-armeabi-v7aNoGcm.apk")
export full64nogcm=$(find artifacts -name "*full-arm64-v8aNoGcm.apk")
export full32nogcm=$(find artifacts -name "*full-armeabi-v7aNoGcm.apk")
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}""")
file_paths = ("""${mini64}""", """${mini32}""", """${full64}""", """${full32}""")
print(file_paths)
list_captions = ("", "", "", "", "", "", "", """Test version, [${{ github.event.head_commit.message }}](${{ github.event.head_commit.url }})""")
for file, caption, message_id in zip(file_paths, list_captions, range(46, 54)):
list_captions = ("", "", "", """Test version, [${{ github.event.head_commit.message }}](${{ github.event.head_commit.url }})""")
for file, caption, message_id in zip(file_paths, list_captions, range(46, 50)):
media = telebot.types.InputMediaDocument(open(file, "rb"), caption=caption, parse_mode='Markdown')
tb.edit_message_media(chat_id=-1001825572660, media=media, message_id=message_id)
tb.copy_messages(chat_id='''${{ secrets.HELPER_BOT_TARGET }}''', message_ids=list(range(46, 54)), from_chat_id=-1001825572660)
tb.copy_messages(chat_id='''${{ secrets.HELPER_BOT_TARGET }}''', message_ids=list(range(46, 50)), from_chat_id=-1001825572660)
EOL
python Send_to_Telegram.py
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ jobs:
strategy:
matrix:
flavor:
# - FullRelease
- FullRelease
- MiniRelease
steps:
- name: Checkout
Expand Down Expand Up @@ -371,5 +371,5 @@ jobs:
echo "APK=$APK" >> $GITHUB_ENV
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.flavor }}
name: Debug
path: ${{ env.APK }}
55 changes: 22 additions & 33 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,6 @@ jobs:
flavor:
- FullRelease
- MiniRelease
- FullReleaseNoGcm
- MiniReleaseNoGcm
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -395,6 +393,13 @@ jobs:
with:
name: telegram-bot-api-binary
path: .
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Setup Python telebot
run: |
pip install telebot
- name: Send to Telegram
run: |
chmod +x telegram-bot-api-binary
Expand All @@ -410,39 +415,23 @@ jobs:
export mini32=$(find artifacts -name "*mini-armeabi-v7a.apk")
export full64=$(find artifacts -name "*full-arm64-v8a.apk")
export full32=$(find artifacts -name "*full-armeabi-v7a.apk")
export mini64nogcm=$(find artifacts -name "*mini-arm64-v8aNoGcm.apk")
export mini32nogcm=$(find artifacts -name "*mini-armeabi-v7aNoGcm.apk")
export full64nogcm=$(find artifacts -name "*full-arm64-v8aNoGcm.apk")
export full32nogcm=$(find artifacts -name "*full-armeabi-v7aNoGcm.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}""")
print(file_paths)
list_captions = ("", "", "", """[${{ github.event.head_commit.message }}](${{ github.event.head_commit.url }})""")
for file, caption, message_id in zip(file_paths, list_captions, range(35, 39)):
media = telebot.types.InputMediaDocument(open(file, "rb"), caption=caption, parse_mode='Markdown')
tb.edit_message_media(chat_id=-1001825572660, media=media, message_id=message_id)
tb.copy_messages(chat_id='''${{ secrets.HELPER_BOT_TARGET }}''', message_ids=list(range(35, 39)), from_chat_id=-1001825572660)
EOL
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
python Send_to_Telegram.py
pkill telegram-bot
telegram-bot-api:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
build/
local.properties
obj/
service_account_credentials.json
service_account_credentials.json
__pycache__/
Loading

0 comments on commit ead7d4e

Please sign in to comment.