2022-05-14 05:57:56 +00:00
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
|
2023-07-11 07:10:03 +00:00
|
|
|
tag = os.environ['TAG_VAL']
|
2022-05-14 05:57:56 +00:00
|
|
|
scan_dir = os.environ['SCAN_DIR']
|
|
|
|
output_dir = os.environ['OUT_DIR']
|
2023-06-05 13:44:12 +00:00
|
|
|
accepted_exts = ["AppImage", "flatpak", "tar.xz", "7z"]
|
2022-05-14 05:57:56 +00:00
|
|
|
|
|
|
|
|
2022-05-14 17:07:57 +00:00
|
|
|
for dir_name in os.listdir(scan_dir):
|
2022-05-14 05:57:56 +00:00
|
|
|
asset_name = "pcsx2-{}".format(tag)
|
2022-05-14 17:07:57 +00:00
|
|
|
if "macos" in dir_name.lower():
|
2022-05-14 05:57:56 +00:00
|
|
|
asset_name += "-macos"
|
2022-05-14 17:07:57 +00:00
|
|
|
elif "linux" in dir_name.lower():
|
2023-06-05 13:44:12 +00:00
|
|
|
if "flatpak" in dir_name.lower():
|
2023-07-09 11:16:46 +00:00
|
|
|
asset_name += "-linux-flatpak-x64"
|
2023-06-05 13:44:12 +00:00
|
|
|
else:
|
2023-07-09 11:16:46 +00:00
|
|
|
asset_name += "-linux-appimage-x64"
|
2022-05-14 17:07:57 +00:00
|
|
|
elif "windows" in dir_name.lower():
|
2023-07-09 11:16:46 +00:00
|
|
|
asset_name += "-windows-x64"
|
2022-05-14 05:57:56 +00:00
|
|
|
else:
|
|
|
|
continue;
|
|
|
|
|
2022-07-19 02:08:27 +00:00
|
|
|
if "avx2" in dir_name.lower():
|
|
|
|
asset_name += "-AVX2"
|
|
|
|
elif "sse4" in dir_name.lower():
|
|
|
|
asset_name += "-SSE4"
|
|
|
|
|
2023-07-09 22:10:12 +00:00
|
|
|
asset_name += "-Qt"
|
|
|
|
|
2022-05-14 17:07:57 +00:00
|
|
|
if "symbols" in dir_name.lower():
|
2022-05-14 05:57:56 +00:00
|
|
|
asset_name += "-symbols"
|
|
|
|
|
|
|
|
print(asset_name)
|
|
|
|
|
|
|
|
dir_handled = False
|
2022-05-14 17:07:57 +00:00
|
|
|
for file in os.listdir(os.path.join(scan_dir, dir_name)):
|
2022-05-14 05:57:56 +00:00
|
|
|
for ext in accepted_exts:
|
|
|
|
if file.endswith(ext):
|
|
|
|
dir_handled = True
|
|
|
|
print("Moving {} to out dir".format(file))
|
2022-05-14 17:07:57 +00:00
|
|
|
shutil.move(os.path.join(scan_dir, dir_name, file), os.path.join(output_dir, asset_name + "." + ext))
|
2022-05-14 05:57:56 +00:00
|
|
|
break
|
|
|
|
if dir_handled:
|
|
|
|
break
|
|
|
|
|
|
|
|
if not dir_handled:
|
|
|
|
print("Could not find asset in directory when one was expected")
|
|
|
|
exit(1)
|