diff --git a/.github/tg.py b/.github/tg.py index befaab722..08536fb55 100644 --- a/.github/tg.py +++ b/.github/tg.py @@ -1,21 +1,21 @@ import telegram -from tgconfig import TG_TOKEN +from tgconfig import * from json import load f = open('commit.json') data = load(f) f.close() -TG_CHAT_ID = "-1001537505605" +TG_POST_ID = "-1001537505605" bot = telegram.Bot(TG_TOKEN) -bot.send_photo(TG_CHAT_ID, open('alpha.png', 'rb'), f'''*Libretube {data['sha'][0:7]} // Alpha* +bot.send_photo(TG_POST_ID, open('alpha.png', 'rb'), f'''*Libretube {data['sha'][0:7]} // Alpha* {data['commit']['message']} Signed-off-by: {data['commit']['author']['name']} ''', parse_mode=telegram.ParseMode.MARKDOWN) -bot.send_document(TG_CHAT_ID, open('app-arm64-v8a-debug.apk', 'rb')) -bot.send_document(TG_CHAT_ID, open('app-armeabi-v7a-debug.apk', 'rb')) -bot.send_document(TG_CHAT_ID, open('app-x86_64-debug.apk', 'rb')) -bot.send_document(TG_CHAT_ID, open('app-x86-debug.apk', 'rb')) +bot.send_document(TG_POST_ID, open('app-arm64-v8a-debug.apk', 'rb')) +bot.send_document(TG_POST_ID, open('app-armeabi-v7a-debug.apk', 'rb')) +bot.send_document(TG_POST_ID, open('app-x86_64-debug.apk', 'rb')) +bot.send_document(TG_POST_ID, open('app-x86-debug.apk', 'rb')) diff --git a/.github/workflows/api-compiler.yml b/.github/workflows/api-compiler.yml new file mode 100644 index 000000000..62e2906c3 --- /dev/null +++ b/.github/workflows/api-compiler.yml @@ -0,0 +1,41 @@ +name: Bot API Compiler + +on: + workflow_dispatch: + +jobs: + debug-builds: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Prepare for Compilation + run: | + sudo apt-get update + sudo apt-get upgrade + sudo apt-get install make git zlib1g-dev libssl-dev gperf cmake g++ + git config --global user.name "XelXen" + git config --global user.email "78258352+XelXen@users.noreply.github.com" + git config --global credential.helper store + echo "https://XelXen:${{ secrets.GH_TOKEN }}@github.com" > ~/.git-credentials + git clone --recursive https://github.com/tdlib/telegram-bot-api.git + cd telegram-bot-api + rm -rf build + mkdir build + cd build + + - name: Patch and Compile + run: | + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. .. + cmake --build . --target install + + - name: Binary Archive + run: | + cd ../.. + git clone https://github.com/LibreTubeAlpha/Telegram-BotAPI bot-api + rm -rf bot-api/* + mv ./telegram-bot-api/bin/telegram-bot-api ./bot-api/exec + cd bot-api + git add -f * + git commit -m "WORKFLOW: BUILD BINARIES" + git push -u \ No newline at end of file diff --git a/.github/workflows/tg-bot.yml b/.github/workflows/tg-bot.yml index ef6e1bbf9..401fccef8 100644 --- a/.github/workflows/tg-bot.yml +++ b/.github/workflows/tg-bot.yml @@ -1,4 +1,4 @@ -name: Telegram Builder +name: Telegram Bot on: workflow_dispatch: @@ -39,7 +39,11 @@ jobs: mv ./app/build/outputs/apk/debug/*.apk .github/ cd .github curl https://libre-tube.github.io/assets/LibreAlpha.png --output alpha.png + curl https://raw.githubusercontent.com/LibreTubeAlpha/Telegram-BotAPI/main/bin/telegram-bot-api --output bot-api echo "TG_TOKEN = '${{ secrets.TG_TOKEN }}'" > tgconfig.py + echo "TG_POST_ID = '${{ secrets.TG_POST_ID }}'" >> tgconfig.py + echo "TG_API_ID = '${{ secrets.TG_API_ID }}'" >> tgconfig.py + echo "TG_API_HASH = '${{ secrets.TG_API_HASH }}'" >> tgconfig.py curl https://api.github.com/repos/${{ github.repository }}/commits/${{ github.sha }} > commit.json python -m pip install --upgrade pip pip install python-telegram-bot