mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 07:50:31 +05:30
commit
7da7c8ef62
13
.github/checkrun.py
vendored
Normal file
13
.github/checkrun.py
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
from json import load
|
||||
from os import system
|
||||
|
||||
f = open('commit.json')
|
||||
data = load(f)
|
||||
f.close()
|
||||
|
||||
message = data['commit']['message']
|
||||
|
||||
if "\n\n" in message:
|
||||
if message.split("\n\n",1)[-1].split()[0] == "[SILENT]":
|
||||
system('killall -9 python')
|
||||
|
12
.github/compiler.sh
vendored
Normal file
12
.github/compiler.sh
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd ~
|
||||
sudo apt-get update -y
|
||||
sudo apt-get upgrade -y
|
||||
sudo apt-get install -y make git zlib1g-dev libssl-dev gperf cmake clang-10 libc++-dev libc++abi-dev
|
||||
git clone --recursive https://github.com/tdlib/telegram-bot-api.git
|
||||
rm -rf telegram-bot-api/build
|
||||
mkdir -p telegram-bot-api/build
|
||||
cd telegram-bot-api/build
|
||||
CXXFLAGS="-stdlib=libc++" CC=/usr/bin/clang-10 CXX=/usr/bin/clang++-10 cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. ..
|
||||
cmake --build . --target install
|
36
.github/tg.py
vendored
36
.github/tg.py
vendored
@ -1,21 +1,33 @@
|
||||
import telegram
|
||||
from tgconfig import TG_TOKEN
|
||||
from tgconfig import *
|
||||
from json import load
|
||||
import multiprocessing
|
||||
from os import system
|
||||
from time import sleep as wait
|
||||
|
||||
f = open('commit.json')
|
||||
data = load(f)
|
||||
f.close()
|
||||
def deploy():
|
||||
system(f'~/bot-api --local --api-id={TG_API_ID} --api-hash={TG_API_HASH}')
|
||||
|
||||
TG_CHAT_ID = "-1001537505605"
|
||||
bot = telegram.Bot(TG_TOKEN)
|
||||
def bot():
|
||||
wait(10)
|
||||
f = open('commit.json')
|
||||
data = load(f)
|
||||
f.close()
|
||||
|
||||
bot.send_photo(TG_CHAT_ID, open('alpha.png', 'rb'), f'''*Libretube {data['sha'][0:7]} // Alpha*
|
||||
bot = telegram.Bot(TG_TOKEN, base_url="http://0.0.0.0:8081/bot")
|
||||
bot.send_photo(TG_POST_ID, open('alpha.png', 'rb'), f'''*Libretube {data['sha'][0:7]} // Alpha*
|
||||
|
||||
{data['commit']['message']}
|
||||
[{data['commit']['message']}]({data['html_url']})
|
||||
|
||||
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_media_group(TG_POST_ID, [telegram.InputMediaDocument(open('app-x86-debug.apk', 'rb')), telegram.InputMediaDocument(open('app-x86_64-debug.apk', 'rb')), telegram.InputMediaDocument(open('app-armeabi-v7a-debug.apk', 'rb')), telegram.InputMediaDocument(open('app-arm64-v8a-debug.apk', 'rb'))])
|
||||
system('killall -9 python')
|
||||
|
||||
if __name__ == '__main__':
|
||||
multideploy = multiprocessing.Process(target=deploy)
|
||||
multibot = multiprocessing.Process(target=bot)
|
||||
multideploy.start()
|
||||
multibot.start()
|
||||
multideploy.join()
|
||||
multibot.join()
|
||||
|
32
.github/workflows/api-compiler.yml
vendored
Normal file
32
.github/workflows/api-compiler.yml
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
name: Bot API Compiler
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
debug-builds:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare for Compilation
|
||||
run: |
|
||||
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
|
||||
|
||||
- name: Run Script
|
||||
run: |
|
||||
chmod 755 .github/compiler.sh
|
||||
.github/compiler.sh
|
||||
|
||||
- name: Binary Archive
|
||||
run: |
|
||||
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
|
16
.github/workflows/tg-bot.yml
vendored
16
.github/workflows/tg-bot.yml
vendored
@ -1,4 +1,4 @@
|
||||
name: Telegram Builder
|
||||
name: Telegram Bot
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@ -20,6 +20,13 @@ jobs:
|
||||
python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
|
||||
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
|
||||
|
||||
- name: Check for Execution Orders
|
||||
run: |
|
||||
cd .github
|
||||
curl https://api.github.com/repos/${{ github.repository }}/commits/${{ github.sha }} > commit.json
|
||||
python checkrun.py
|
||||
cd ..
|
||||
|
||||
- name: set up JDK 11
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
@ -35,12 +42,17 @@ jobs:
|
||||
./gradlew assembleDebug
|
||||
|
||||
- name: Telegram Bot
|
||||
continue-on-error: true
|
||||
run: |
|
||||
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/exec --output ~/bot-api
|
||||
chmod 755 ~/bot-api
|
||||
echo "TG_TOKEN = '${{ secrets.TG_TOKEN }}'" > tgconfig.py
|
||||
curl https://api.github.com/repos/${{ github.repository }}/commits/${{ github.sha }} > commit.json
|
||||
echo "TG_API_ID = '${{ secrets.TG_API_ID }}'" >> tgconfig.py
|
||||
echo "TG_POST_ID = '${{ secrets.TG_POST_ID }}'" >> tgconfig.py
|
||||
echo "TG_API_HASH = '${{ secrets.TG_API_HASH }}'" >> tgconfig.py
|
||||
python -m pip install --upgrade pip
|
||||
pip install python-telegram-bot
|
||||
python tg.py
|
||||
|
Loading…
x
Reference in New Issue
Block a user