mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 22:00:30 +05:30
Merge pull request #1319 from LibreTubeAlpha/master
Centralise Builder and Bot
This commit is contained in:
commit
4d3439fd96
7
.github/checkrun.py
vendored
7
.github/checkrun.py
vendored
@ -5,13 +5,12 @@ f = open('commit.json')
|
||||
data = load(f)
|
||||
f.close()
|
||||
|
||||
message = data['commit']['message']
|
||||
data = data['commit']['message']
|
||||
|
||||
if "\n\n" in message:
|
||||
if message.split("\n\n",1)[-1].split()[0] == "[SILENT]":
|
||||
if "\n\n" in data:
|
||||
if data.split("\n\n",1)[-1].split()[0] == "[SILENT]":
|
||||
system('killall -9 python')
|
||||
else:
|
||||
print("Silence not found")
|
||||
else:
|
||||
print("Empty Description")
|
||||
|
||||
|
4
.github/tg.py
vendored
4
.github/tg.py
vendored
@ -6,7 +6,7 @@ from os import system
|
||||
from time import sleep as wait
|
||||
|
||||
def deploy():
|
||||
system(f'~/bot-api --local --api-id={TG_API_ID} --api-hash={TG_API_HASH}')
|
||||
system(f'./bot-api --local --api-id={TG_API_ID} --api-hash={TG_API_HASH}')
|
||||
|
||||
def bot():
|
||||
wait(10)
|
||||
@ -21,7 +21,7 @@ def bot():
|
||||
|
||||
Signed-off-by: {data['commit']['author']['name']}
|
||||
''', parse_mode=telegram.ParseMode.MARKDOWN)
|
||||
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'))])
|
||||
bot.send_media_group(TG_POST_ID, [telegram.InputMediaDocument(open('app-universal-debug.apk', 'rb')), 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__':
|
||||
|
6
.github/workflows/api-compiler.yml
vendored
6
.github/workflows/api-compiler.yml
vendored
@ -21,10 +21,10 @@ jobs:
|
||||
chmod 755 .github/compiler.sh
|
||||
.github/compiler.sh
|
||||
|
||||
- name: Binary Archive
|
||||
- name: Upload to Archive
|
||||
run: |
|
||||
git clone https://github.com/LibreTubeAlpha/Telegram-BotAPI bot-api
|
||||
rm -rf bot-api/*
|
||||
git clone https://github.com/LibreTubeAlpha/Archive bot-api
|
||||
rm -rf bot-api/exec
|
||||
mv ~/telegram-bot-api/bin/telegram-bot-api bot-api/exec
|
||||
cd bot-api
|
||||
git add -f *
|
||||
|
50
.github/workflows/ci.yml
vendored
50
.github/workflows/ci.yml
vendored
@ -21,14 +21,32 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: gradle/wrapper-validation-action@v1
|
||||
- uses: actions/setup-python@v3
|
||||
with:
|
||||
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: set up JDK 11
|
||||
- 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:
|
||||
java-version: 11
|
||||
distribution: "temurin"
|
||||
cache: "gradle"
|
||||
|
||||
- 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: Patch and Compile
|
||||
run: |
|
||||
cd .github
|
||||
@ -36,8 +54,36 @@ jobs:
|
||||
cd ..
|
||||
./gradlew assembleDebug
|
||||
|
||||
- name: Upload to Archive
|
||||
continue-on-error: true
|
||||
run: |
|
||||
git clone https://github.com/LibreTubeAlpha/Archive archive
|
||||
rm -rf archive/*.apk
|
||||
mv app/build/outputs/apk/debug/*.apk archive/
|
||||
cd archive
|
||||
git add -f *
|
||||
git commit -m "WORKFLOW: ALPHA BUILDS"
|
||||
git push -u
|
||||
|
||||
- name: Telegram Bot
|
||||
continue-on-error: true
|
||||
run: |
|
||||
cd archive
|
||||
curl https://libre-tube.github.io/images/LibreAlpha.png --output alpha.png
|
||||
curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/exec --output bot-api
|
||||
chmod 755 ./bot-api
|
||||
echo "TG_TOKEN = '${{ secrets.TG_TOKEN }}'" > tgconfig.py
|
||||
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
|
||||
mv ../.github/tg.py .
|
||||
mv ../.github/commit.json .
|
||||
python tg.py
|
||||
|
||||
- name: Upload APK
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: app
|
||||
path: app/build/outputs/apk/debug/*.apk
|
||||
path: archive/*.apk
|
||||
|
58
.github/workflows/tg-bot.yml
vendored
58
.github/workflows/tg-bot.yml
vendored
@ -1,58 +0,0 @@
|
||||
name: Telegram Bot
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths-ignore:
|
||||
- "README*.md"
|
||||
- "fastlane/**"
|
||||
- "assets/**"
|
||||
- ".github/**/*.md"
|
||||
|
||||
jobs:
|
||||
debug-builds:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: gradle/wrapper-validation-action@v1
|
||||
- uses: actions/setup-python@v3
|
||||
with:
|
||||
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:
|
||||
java-version: 11
|
||||
distribution: "temurin"
|
||||
cache: "gradle"
|
||||
|
||||
- name: Patch and Compile
|
||||
run: |
|
||||
cd .github
|
||||
python patch.py
|
||||
cd ..
|
||||
./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/images/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
|
||||
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…
Reference in New Issue
Block a user