noita_entangled_worlds/scripts/ci_make_archives.py

42 lines
2 KiB
Python
Raw Permalink Normal View History

2024-11-26 16:08:37 +03:00
import os
2024-11-26 17:16:35 +03:00
import sys
2024-11-26 16:08:37 +03:00
from zipfile import ZipFile, ZIP_DEFLATED as COMPRESS_TYPE
import shutil
2024-11-26 17:16:35 +03:00
from ci_version import version
2024-11-26 16:30:21 +03:00
2024-11-26 17:16:35 +03:00
COMPRESS_LEVEL = 9
2024-11-26 15:50:33 +03:00
os.makedirs("target", exist_ok=True)
2024-11-26 17:16:35 +03:00
mode = sys.argv[1]
if mode == "windows":
print("Writing windows release...")
2024-11-26 15:50:33 +03:00
2024-11-26 17:16:35 +03:00
with ZipFile("target/noita-proxy-win.zip", "w") as release:
2025-02-14 17:21:05 +03:00
release.write("noita-proxy/target/release/noita-proxy.exe", arcname="noita_proxy.exe", compress_type=COMPRESS_TYPE, compresslevel=COMPRESS_LEVEL)
2024-11-26 17:16:35 +03:00
release.write("redist/steam_api64.dll", arcname="steam_api64.dll", compress_type=COMPRESS_TYPE, compresslevel=COMPRESS_LEVEL)
elif mode == "linux":
print("Writing linux release...")
2024-11-26 15:50:33 +03:00
2024-11-26 17:16:35 +03:00
with ZipFile("target/noita-proxy-linux.zip", "w") as release:
release.write("noita-proxy/target/release/noita-proxy", arcname="noita_proxy.x86_64", compress_type=COMPRESS_TYPE, compresslevel=COMPRESS_LEVEL)
2025-10-06 15:42:52 +03:00
release.write("scripts/start-lutris.sh", arcname="start-lutris.sh", compress_type=COMPRESS_TYPE, compresslevel=COMPRESS_LEVEL)
2024-11-26 17:16:35 +03:00
release.write("redist/libsteam_api.so", arcname="libsteam_api.so", compress_type=COMPRESS_TYPE, compresslevel=COMPRESS_LEVEL)
2025-04-25 20:39:11 +03:00
elif mode == "macos":
print("Writing macos release...")
with ZipFile("target/noita-proxy-macos.zip", "w") as release:
#release.write("noita-proxy/assets/Info.plist", arcname="noita_proxy.app/Contents/Info.plist", compress_type=COMPRESS_TYPE, compresslevel=COMPRESS_LEVEL)
2025-06-20 16:49:26 -04:00
release.write("noita-proxy/target/release/noita-proxy", arcname="noita_proxy", compress_type=COMPRESS_TYPE, compresslevel=COMPRESS_LEVEL)
release.write("redist/libsteam_api.dylib", arcname="libsteam_api.dylib", compress_type=COMPRESS_TYPE, compresslevel=COMPRESS_LEVEL)
2024-11-26 17:16:35 +03:00
elif mode == "mod":
print("Writing mod release...")
2024-11-26 15:50:33 +03:00
2024-11-26 17:16:35 +03:00
shutil.make_archive("target/quant.ew", "zip", "quant.ew")
2024-11-26 15:50:33 +03:00
2024-11-26 17:16:35 +03:00
with ZipFile("target/quant.ew.zip", "a") as release:
release.writestr("files/version.lua", f'return "{version}"')
else:
2025-06-20 14:18:05 -04:00
exit(-1)