Last active
November 15, 2020 03:53
-
-
Save EIREXE/b76c2e762c6ed60c58fdd9a01fcfa143 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
parser = argparse.ArgumentParser(description='Builds PH') | |
parser.add_argument("--master", default=argparse.SUPPRESS) | |
args = parser.parse_args() | |
PROJECT_DIR="/home/eirexe/Project Heartbeat/Project Heartbeat" | |
if "master" in args: | |
if args.master is not None: | |
PROJECT_DIR="/home/eirexe/Project Heartbeat/Project Heartbeat - Master" | |
GODOT_BUILD="/home/eirexe/Project Heartbeat/engine/godot.x11.opt.tools.64" | |
BUILD_TARGET="/home/eirexe/Project Heartbeat/Steam Release" | |
PLATFORMS=[ | |
{ | |
"name": "Linux Debug", | |
"file_name": "Project Heartbeat.x86_64" | |
}, | |
{ | |
"name": "Windows Desktop Debug", | |
"file_name": "Project Heartbeat.exe" | |
} | |
] | |
import subprocess | |
import os | |
import time | |
import git | |
repo = git.Repo(PROJECT_DIR) | |
sha = repo.head.object.hexsha | |
from os.path import expanduser | |
OUT = "" | |
with open(os.path.join(PROJECT_DIR, "project.godot"), "r") as project_file: | |
lines = project_file.readlines() | |
for line in lines: | |
if line.startswith("config/build_time"): | |
OUT += "config/build_time=" + str(int(time.time())) + "\n" | |
elif line.startswith("config/build_commit"): | |
OUT += "config/build_commit=\"" + str(sha) + "\"\n" | |
elif line.startswith("config/service_environment"): | |
OUT_LINE = "config/service_environment=\"production\"\n" | |
if "master" in args: | |
if args.master is not None: | |
OUT_LINE = "config/service_environment=\"production\"\n" | |
OUT += OUT_LINE | |
else: | |
OUT += line | |
with open(os.path.join(PROJECT_DIR, "project.godot"), "w+") as project_file: | |
project_file.write(OUT) | |
for platform in PLATFORMS: | |
print("building for " + platform["name"]) | |
subprocess.call([GODOT_BUILD, "--path", PROJECT_DIR, "--export-debug", platform["name"], os.path.join(BUILD_TARGET, platform["file_name"])], cwd="/home/eirexe/Project Heartbeat/engine") | |
home = expanduser("~") | |
call_args = ["steamcmd", "+runscript", os.path.join(home, "sc")] | |
if "master" in args: | |
if args.master is not None: | |
call_args = ["steamcmd", "+runscript", os.path.join(home, "sc-master")] | |
subprocess.call(call_args) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
login "<user_name>" | |
run_app_build "/home/eirexe/Project Heartbeat/Steam SDK/sdk/tools/ContentBuilder/scripts/app_build_1216230.vdf" | |
quit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment