1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-05 18:42:29 +01:00

Refactor script to only job is to upload to steam

our ci does the rest
This commit is contained in:
Elias Steurer 2023-08-24 16:43:46 +02:00
parent 325c47f87b
commit 4c0881ebfe
2 changed files with 7 additions and 49 deletions

View File

@ -49,7 +49,7 @@ def execute(
step_time = time.time()
build_result = build(build_config, build_result)
build_duration = time.time() - step_time
# print(f"⏱️ build_duration (for {build_config.build_architecture}): {build_duration}s")
print(f"⏱️ build_duration: {build_duration}s")
# Copies all needed libraries and assets into the bin folder
step_time = time.time()

View File

@ -20,9 +20,7 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(
description='Build and Package ScreenPlay')
parser.add_argument('--skip_steam_publish', '-skstp', action="store_true",
dest="skip_publish", default=False, help="skip publish")
parser.add_argument('--skip_getspde_publish', '-skgsp', action="store_true",
dest="skip_getspde_publish", default=False, help="skip getsp.de publish")
dest="skip_steam_publish", default=False, help="skip publish")
parser.add_argument('--skip_build', '-skb', action="store_true", dest="skip_build",
default=False, help="skip build. If we already have a build and only want to upload it")
parser.add_argument('--steam_password', '-sp', action="store",
@ -33,6 +31,10 @@ if __name__ == "__main__":
dest="hosting_password", help="ssh password")
args = parser.parse_args()
if not args.skip_steam_publish and args.steam_password is None:
print("Steam password is required.")
sys.exit(1)
# Script needs to run in the tools folder
tools_path = Path.cwd()
os.chdir(tools_path)
@ -61,14 +63,11 @@ if __name__ == "__main__":
build_config.build_steam = "ON"
build_config.build_tests = "OFF"
build_config.build_deploy = "ON"
build_config.create_installer = "ON"
build_config.create_installer = "OFF"
build_config.build_type = "release"
build_config.screenplay_version = screenplay_version
if platform.system() == "Darwin" and not args.skip_build:
# We do not yet support a standalone osx installer
build_config.create_installer = "OFF"
# We need to manually package here at the end after
build_config.package = True
build_config.sign_osx = True
@ -77,53 +76,12 @@ if __name__ == "__main__":
build_result = build.execute(build_config)
if platform.system() == "Windows" and not args.skip_build:
build_config.build_architecture = "x64"
if not args.skip_getspde_publish:
# Steamless version first
build_config.build_steam = "OFF"
build_result = build.execute(build_config)
ssh = paramiko.SSHClient()
ssh.load_system_host_keys()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('kelteseth.com', username=args.hosting_username,
password=args.hosting_password)
sftp = ssh.open_sftp()
release_folder = "/getsp.de/" + build_config.screenplay_version + "/"
if sftp_exists(sftp, release_folder):
remoteFiles = sftp.listdir(path=release_folder)
for file in remoteFiles:
print(f"Delte old: {release_folder+file}")
sftp.remove(release_folder+file)
else:
sftp.mkdir(release_folder)
print("Uploading files...")
sftp.put(build_result.build_zip, release_folder +
str(build_result.build_zip.name))
sftp.put(build_result.installer, release_folder +
str(build_result.installer.name))
sftp.put(build_result.installer_zip, release_folder +
str(build_result.installer_zip.name))
sftp.put(build_result.build_hash, release_folder +
str(build_result.build_hash.name))
sftp.close()
ssh.close()
# Now build the steam version
os.chdir(tools_path)
build_config.build_steam = "ON"
build_config.create_installer = "OFF"
build_result = build.execute(build_config)
if args.skip_steam_publish:
print("Skip steam publishing.")
sys.exit(0)
if args.steam_password is None:
print("Steam password is required.")
sys.exit(1)
# Make sure to reset to tools path
os.chdir(tools_path)
steam_publish.publish(