Build Bot API

This commit is contained in:
XelXen 2022-06-16 14:33:41 +05:30 committed by GitHub
parent 43f3cd0c2b
commit 1218eb53d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 8 deletions

14
.github/tg.py vendored
View File

@ -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'))

41
.github/workflows/api-compiler.yml vendored Normal file
View File

@ -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

View File

@ -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