Enable SHA Checking

This commit is contained in:
XelXen 2022-09-18 10:47:24 +05:30 committed by GitHub
parent 08a546c0b5
commit df133f0a36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 31 deletions

3
.github/checkrun.py vendored
View File

@ -13,5 +13,4 @@ if "\n\n" in message:
else:
print("Silence not found")
else:
print("Empty Description")
print("Empty Description")

39
.github/pkg.py vendored
View File

@ -1,29 +1,24 @@
import os
from json import load
data = load(open('commit.json'))
while True:
os.system("curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/latestBuild/app-x86-debug.apk --output app-x86-debug.apk")
outputStr = open("app-x86-debug.apk","r").read()
if "Not Found" not in outputStr:
print("Build [x86] Downloaded")
os.system('curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/sign.txt --output sign.txt')
f = open('sign.txt')
if f == data['sha'][0:7]:
break
while True:
os.system("curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/latestBuild/app-x86_64-debug.apk --output app-x86_64-debug.apk")
outputStr = open("app-x86_64-debug.apk","r").read()
if "Not Found" not in outputStr:
print("Build [x86_64] Downloaded")
break
os.system("curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/latestBuild/app-x86-debug.apk --output app-x86-debug.apk")
print("Build [x86] Downloaded")
while True:
os.system("curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/latestBuild/app-armeabi-v7a-debug.apk --output app-armeabi-v7a-debug.apk")
outputStr = open("app-armeabi-v7a-debug.apk","r").read()
if "Not Found" not in outputStr:
print("Build [arm7] Downloaded")
break
os.system("curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/latestBuild/app-x86_64-debug.apk --output app-x86_64-debug.apk")
print("Build [x86_64] Downloaded")
while True:
os.system("curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/latestBuild/app-armeabi-v8a-debug.apk --output app-armeabi-v8a-debug.apk")
outputStr = open("app-armeabi-v8a-debug.apk","r").read()
if "Not Found" not in outputStr:
print("Build [arm8] Downloaded")
break
os.system("curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/latestBuild/app-armeabi-v7a-debug.apk --output app-armeabi-v7a-debug.apk")
print("Build [arm7] Downloaded")
os.system("curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/latestBuild/app-armeabi-v8a-debug.apk --output app-armeabi-v8a-debug.apk")
print("Build [arm8] Downloaded")
os.system("curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/latestBuild/app-universal-debug.apk --output app-armeabi-v8a-debug.apk")
print("Build [universal] Downloaded")

4
.github/sign.py vendored Normal file
View File

@ -0,0 +1,4 @@
from json import load
f = open('sign.txt', "w")
f.write(data['sha'][0:7])

4
.github/tg.py vendored
View File

@ -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-x86-debug.apk', 'rb')), telegram.InputMediaDocument(open('app-universal-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__':

View File

@ -25,8 +25,10 @@ jobs:
- name: Check for Execution Orders
run: |
cd .github
touch sign.txt
curl https://api.github.com/repos/${{ github.repository }}/commits/${{ github.sha }} > commit.json
python checkrun.py
python sign.py
cd ..
- name: Set up JDK 11
@ -53,8 +55,9 @@ jobs:
- name: Upload to Archive
run: |
git clone https://github.com/LibreTubeAlpha/Archive archive
rm -rf archive/*.apk
rm -rf archive/*.apk archive/sign.txt
mv app/build/outputs/apk/debug/*.apk archive/
mv .github/sign.txt archive/
cd archive
git add -f *
git commit -m "WORKFLOW: ALPHA BUILDS"

View File

@ -22,22 +22,24 @@ jobs:
- name: Check for Execution Orders
run: |
cd .github
mv checkrun.py ~
cd ~
curl https://api.github.com/repos/${{ github.repository }}/commits/${{ github.sha }} > commit.json
python checkrun.py
cd ..
- name: Download packages
run: |
cd ~
mv .github/pkg.py .
cd .github
python pkg.py
cd ..
- name: Telegram Bot
continue-on-error: true
run: |
cd ~
cd .github
curl https://libre-tube.github.io/images/LibreAlpha.png --output alpha.png
curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/exec --output ~/bot-api
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