2023-01-19 10:33:49 +01:00
|
|
|
#!/usr/bin/python3
|
|
|
|
# SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only
|
2022-07-09 13:05:42 +02:00
|
|
|
import steam_publish
|
2022-08-26 15:45:49 +02:00
|
|
|
import sys
|
2022-07-09 13:05:42 +02:00
|
|
|
import argparse
|
|
|
|
import os
|
2022-07-24 17:56:00 +02:00
|
|
|
import build
|
2022-07-09 13:05:42 +02:00
|
|
|
from pathlib import Path
|
2022-07-22 13:21:30 +02:00
|
|
|
import platform
|
2022-10-10 11:35:41 +02:00
|
|
|
import defines
|
2023-08-24 16:17:48 +02:00
|
|
|
from build_result import BuildResult
|
|
|
|
from build_config import BuildConfig
|
2023-08-24 17:17:22 +02:00
|
|
|
from util import get_latest_git_tag, parse_semver, semver_to_string
|
2022-11-02 12:15:34 +01:00
|
|
|
from sys import stdout
|
|
|
|
|
|
|
|
stdout.reconfigure(encoding='utf-8')
|
|
|
|
|
2022-07-09 13:05:42 +02:00
|
|
|
if __name__ == "__main__":
|
2023-08-17 14:26:39 +02:00
|
|
|
parser = argparse.ArgumentParser(
|
|
|
|
description='Build and Package ScreenPlay')
|
|
|
|
parser.add_argument('--skip_steam_publish', '-skstp', action="store_true",
|
2023-08-24 16:43:46 +02:00
|
|
|
dest="skip_steam_publish", default=False, help="skip publish")
|
2023-08-17 14:26:39 +02:00
|
|
|
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",
|
|
|
|
dest="steam_password", help="Steam password")
|
|
|
|
parser.add_argument('--hosting_username', '-hu', action="store",
|
|
|
|
dest="hosting_username", help="ssh username")
|
|
|
|
parser.add_argument('--hosting_password', '-hp', action="store",
|
|
|
|
dest="hosting_password", help="ssh password")
|
2022-07-09 13:05:42 +02:00
|
|
|
args = parser.parse_args()
|
|
|
|
|
2023-08-24 16:43:46 +02:00
|
|
|
if not args.skip_steam_publish and args.steam_password is None:
|
|
|
|
print("Steam password is required.")
|
|
|
|
sys.exit(1)
|
|
|
|
|
2023-08-24 17:17:22 +02:00
|
|
|
if not steam_publish.check_steam_login("tachiom", args.steam_password):
|
|
|
|
print("Failed to login to Steam!")
|
|
|
|
exit(1)
|
|
|
|
|
2022-07-09 13:05:42 +02:00
|
|
|
# Script needs to run in the tools folder
|
|
|
|
tools_path = Path.cwd()
|
|
|
|
os.chdir(tools_path)
|
2022-07-22 13:21:30 +02:00
|
|
|
root_path = tools_path.parent
|
|
|
|
print(f"Set root directory to: {root_path}")
|
|
|
|
|
2023-08-17 14:26:39 +02:00
|
|
|
tag = get_latest_git_tag()
|
|
|
|
if tag:
|
|
|
|
print(f"Latest Git tag: {tag}")
|
|
|
|
semver = parse_semver(tag)
|
|
|
|
if semver:
|
|
|
|
print(f"Parsed SemVer: {semver}")
|
|
|
|
screenplay_version = semver_to_string(semver)
|
|
|
|
else:
|
|
|
|
print("Failed to parse SemVer.")
|
|
|
|
exit(-1)
|
|
|
|
else:
|
|
|
|
print("No git tags found.")
|
|
|
|
exit(-1)
|
|
|
|
|
2023-08-24 16:17:48 +02:00
|
|
|
build_result = BuildResult()
|
2022-07-24 17:56:00 +02:00
|
|
|
|
2023-08-24 16:17:48 +02:00
|
|
|
build_config = BuildConfig()
|
2022-10-10 11:35:41 +02:00
|
|
|
build_config.qt_version = defines.QT_VERSION
|
|
|
|
build_config.qt_ifw_version = defines.QT_IFW_VERSION
|
2022-07-24 17:56:00 +02:00
|
|
|
build_config.build_steam = "ON"
|
|
|
|
build_config.build_tests = "OFF"
|
2022-08-14 11:58:41 +02:00
|
|
|
build_config.build_deploy = "ON"
|
2023-08-24 16:43:46 +02:00
|
|
|
build_config.create_installer = "OFF"
|
2022-07-24 17:56:00 +02:00
|
|
|
build_config.build_type = "release"
|
2023-08-17 14:26:39 +02:00
|
|
|
build_config.screenplay_version = screenplay_version
|
2022-07-24 17:56:00 +02:00
|
|
|
|
2023-01-05 13:42:58 +01:00
|
|
|
if platform.system() == "Darwin" and not args.skip_build:
|
2022-08-26 15:45:49 +02:00
|
|
|
# We need to manually package here at the end after
|
|
|
|
build_config.package = True
|
2023-02-11 11:57:09 +01:00
|
|
|
build_config.sign_osx = True
|
2022-08-26 15:45:49 +02:00
|
|
|
|
2023-02-11 11:57:09 +01:00
|
|
|
# This will build both arm64 and x64 and sign the unversal binary
|
2022-07-24 17:56:00 +02:00
|
|
|
build_result = build.execute(build_config)
|
|
|
|
|
2023-01-05 13:42:58 +01:00
|
|
|
if platform.system() == "Windows" and not args.skip_build:
|
2022-11-02 16:41:06 +01:00
|
|
|
build_result = build.execute(build_config)
|
|
|
|
|
2023-08-17 14:26:39 +02:00
|
|
|
if args.skip_steam_publish:
|
|
|
|
print("Skip steam publishing.")
|
2022-11-02 16:39:23 +01:00
|
|
|
sys.exit(0)
|
2022-11-02 16:41:55 +01:00
|
|
|
|
2022-08-07 12:24:07 +02:00
|
|
|
# Make sure to reset to tools path
|
2022-08-26 15:43:50 +02:00
|
|
|
os.chdir(tools_path)
|
|
|
|
steam_publish.publish(
|
|
|
|
steam_username="tachiom",
|
|
|
|
steam_password=args.steam_password,
|
|
|
|
set_live_branch_name="internal"
|
|
|
|
)
|