2022-11-27 20:59:42 +05:30
|
|
|
from os import system as run, listdir, remove
|
2023-04-27 00:21:46 +05:30
|
|
|
from json import load
|
2023-11-28 23:13:48 +05:30
|
|
|
import config_file
|
2023-09-13 14:37:18 +05:30
|
|
|
import hashlib
|
2022-09-21 19:34:55 +05:30
|
|
|
|
2023-04-26 22:46:52 +05:30
|
|
|
with open("../.github/commit.json") as f:
|
|
|
|
data = load(f)
|
|
|
|
|
|
|
|
message = f"Commit {data['sha'][0:7]}, signed off by: {data['commit']['author']['name']}"
|
2022-11-27 20:59:42 +05:30
|
|
|
|
|
|
|
files, signed_files, unsigned_files = listdir(), [], []
|
|
|
|
for file in files:
|
|
|
|
if file.endswith("signed.apk"):
|
|
|
|
signed_files.append(file)
|
|
|
|
elif file.endswith(".apk"):
|
|
|
|
unsigned_files.append(file)
|
|
|
|
|
|
|
|
if len(signed_files):
|
|
|
|
for file in unsigned_files:
|
|
|
|
remove(file)
|
|
|
|
|
2023-09-13 14:37:18 +05:30
|
|
|
with open("checksums", "w") as checksums:
|
|
|
|
for file in signed_files or unsigned_files:
|
|
|
|
with open(file, "rb") as apk:
|
|
|
|
bytes = apk.read()
|
|
|
|
sha256hash = hashlib.sha256(bytes).hexdigest()
|
|
|
|
checksums.write(sha256hash + " " + apk.name + "\n")
|
|
|
|
|
2023-11-28 23:59:24 +05:30
|
|
|
if config_file.GH_REPO.lower() == "libre-tube/libretube":
|
2022-09-21 19:34:55 +05:30
|
|
|
run("git add -f *")
|
2023-11-19 22:37:39 +05:30
|
|
|
run(f'git commit -m "{message}"')
|
2022-09-22 11:21:14 +05:30
|
|
|
run("git push -u")
|
|
|
|
else:
|
2022-11-27 20:59:42 +05:30
|
|
|
print("Official Repo not Detected")
|