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: else:
print("Silence not found") print("Silence not found")
else: else:
print("Empty Description") print("Empty Description")

39
.github/pkg.py vendored
View File

@ -1,29 +1,24 @@
import os import os
from json import load
data = load(open('commit.json'))
while True: while True:
os.system("curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/latestBuild/app-x86-debug.apk --output app-x86-debug.apk") os.system('curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/sign.txt --output sign.txt')
outputStr = open("app-x86-debug.apk","r").read() f = open('sign.txt')
if "Not Found" not in outputStr: if f == data['sha'][0:7]:
print("Build [x86] Downloaded")
break break
while True: os.system("curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/latestBuild/app-x86-debug.apk --output app-x86-debug.apk")
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] Downloaded")
outputStr = open("app-x86_64-debug.apk","r").read()
if "Not Found" not in outputStr:
print("Build [x86_64] Downloaded")
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")
os.system("curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/latestBuild/app-armeabi-v7a-debug.apk --output app-armeabi-v7a-debug.apk") print("Build [x86_64] Downloaded")
outputStr = open("app-armeabi-v7a-debug.apk","r").read()
if "Not Found" not in outputStr:
print("Build [arm7] Downloaded")
break
while True: os.system("curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/latestBuild/app-armeabi-v7a-debug.apk --output app-armeabi-v7a-debug.apk")
os.system("curl https://raw.githubusercontent.com/LibreTubeAlpha/Archive/main/latestBuild/app-armeabi-v8a-debug.apk --output app-armeabi-v8a-debug.apk") print("Build [arm7] Downloaded")
outputStr = open("app-armeabi-v8a-debug.apk","r").read()
if "Not Found" not in outputStr: 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") print("Build [arm8] Downloaded")
break
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 from time import sleep as wait
def deploy(): 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(): def bot():
wait(10) wait(10)
@ -21,7 +21,7 @@ def bot():
Signed-off-by: {data['commit']['author']['name']} Signed-off-by: {data['commit']['author']['name']}
''', parse_mode=telegram.ParseMode.MARKDOWN) ''', 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') system('killall -9 python')
if __name__ == '__main__': if __name__ == '__main__':

View File

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

View File

@ -22,22 +22,24 @@ jobs:
- name: Check for Execution Orders - name: Check for Execution Orders
run: | run: |
cd .github cd .github
mv checkrun.py ~
cd ~
curl https://api.github.com/repos/${{ github.repository }}/commits/${{ github.sha }} > commit.json curl https://api.github.com/repos/${{ github.repository }}/commits/${{ github.sha }} > commit.json
python checkrun.py python checkrun.py
cd .. cd ..
- name: Download packages - name: Download packages
run: | run: |
cd ~ cd .github
mv .github/pkg.py .
python pkg.py python pkg.py
cd ..
- name: Telegram Bot - name: Telegram Bot
continue-on-error: true continue-on-error: true
run: | run: |
cd ~ cd .github
curl https://libre-tube.github.io/images/LibreAlpha.png --output alpha.png 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 chmod 755 ./bot-api
echo "TG_TOKEN = '${{ secrets.TG_TOKEN }}'" > tgconfig.py echo "TG_TOKEN = '${{ secrets.TG_TOKEN }}'" > tgconfig.py
echo "TG_API_ID = '${{ secrets.TG_API_ID }}'" >> tgconfig.py echo "TG_API_ID = '${{ secrets.TG_API_ID }}'" >> tgconfig.py