mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Add steam publish python script with dynamic description based on git branch, hash and date
This commit is contained in:
parent
662a0934e9
commit
ddcb83b79b
67
Tools/steam_publish.py
Normal file
67
Tools/steam_publish.py
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import subprocess
|
||||||
|
import shutil
|
||||||
|
import argparse
|
||||||
|
from sys import platform
|
||||||
|
from execute_util import execute
|
||||||
|
from datetime import datetime
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
# Executes steamcmd with username and password. Changes the content of the config
|
||||||
|
# for better readability in the steam builds tab
|
||||||
|
# https://partner.steamgames.com/apps/builds/672870
|
||||||
|
|
||||||
|
def get_git_revision_short_hash():
|
||||||
|
return subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD'])
|
||||||
|
|
||||||
|
|
||||||
|
def get_git_branch_hash():
|
||||||
|
return subprocess.check_output(['git', 'branch', '--show-current'])
|
||||||
|
|
||||||
|
|
||||||
|
# MAIN
|
||||||
|
parser = argparse.ArgumentParser(description='Publish ScreenPlay to Steam')
|
||||||
|
parser.add_argument('-u', action="store", dest="steam_username", required=True,
|
||||||
|
help="Steam Username.")
|
||||||
|
parser.add_argument('-p', action="store", dest="steam_password", required=True,
|
||||||
|
help="Steam Password.")
|
||||||
|
parser.add_argument('-c', action="store", dest="vdf_config_name", required=True,
|
||||||
|
help="Name to the .vdf config. This will use the .vdf files from the steamcmd folder.")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
abs_vdf_path = os.path.abspath("steamcmd/"+args.vdf_config_name)
|
||||||
|
|
||||||
|
if not os.path.isfile(abs_vdf_path):
|
||||||
|
print("Incorrect vdf name")
|
||||||
|
sys.exit(-1)
|
||||||
|
|
||||||
|
file = open(abs_vdf_path, "r")
|
||||||
|
|
||||||
|
config_content = file.read()
|
||||||
|
git_hash = get_git_revision_short_hash().decode("utf-8").replace("\n", "")
|
||||||
|
git_branch = get_git_branch_hash().decode("utf-8").replace("\n", "")
|
||||||
|
current_date_time = datetime.now().strftime("%m/%d/%Y, %H:%M:%S")
|
||||||
|
|
||||||
|
build_description = "- git hash: " + git_hash + ", branch: " + git_branch + " - upload datetime: " + current_date_time
|
||||||
|
config_content = config_content.replace("{{BUILD_DESCRIPTION}}", build_description)
|
||||||
|
tmp_steam_config_foldername = "tmp_steam_config/"
|
||||||
|
tmp_steam_config_dir = os.path.abspath(tmp_steam_config_foldername)
|
||||||
|
|
||||||
|
if os.path.isdir(tmp_steam_config_dir):
|
||||||
|
shutil.rmtree(tmp_steam_config_dir)
|
||||||
|
|
||||||
|
os.mkdir(tmp_steam_config_dir)
|
||||||
|
|
||||||
|
f = open(os.path.abspath(tmp_steam_config_dir + "/" + args.vdf_config_name), "w")
|
||||||
|
f.write(config_content)
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
tmp_steam_config_path = "\"" + os.path.abspath(tmp_steam_config_foldername + args.vdf_config_name) + "\""
|
||||||
|
|
||||||
|
print("Execute steamcmd on: " + tmp_steam_config_path)
|
||||||
|
execute("steamcmd +login {username} {password} +run_app_build {config} +quit".format(username=steam_username, password=steam_password, config=tmp_steam_config_path))
|
||||||
|
|
||||||
|
print("Deleting tmp config")
|
||||||
|
shutil.rmtree(tmp_steam_config_dir)
|
@ -1,7 +1,7 @@
|
|||||||
"appbuild"
|
"appbuild"
|
||||||
{
|
{
|
||||||
"appid" "672870"
|
"appid" "672870"
|
||||||
"desc" "CI Build linux"
|
"desc" "CI Build linux {{BUILD_DESCRIPTION}}"
|
||||||
"buildoutput" "../../ContentBuilder/output" // build output folder for .log, .csm & .csd files, relative to location of this file
|
"buildoutput" "../../ContentBuilder/output" // build output folder for .log, .csm & .csd files, relative to location of this file
|
||||||
"contentroot" "../../" // root content folder, relative to location of this file
|
"contentroot" "../../" // root content folder, relative to location of this file
|
||||||
"setlive" "internal" // branch to set live after successful build, none if empty
|
"setlive" "internal" // branch to set live after successful build, none if empty
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"appbuild"
|
"appbuild"
|
||||||
{
|
{
|
||||||
"appid" "672870"
|
"appid" "672870"
|
||||||
"desc" "CI Build mac"
|
"desc" "CI Build mac {{BUILD_DESCRIPTION}}"
|
||||||
"buildoutput" "../../ContentBuilder/output" // build output folder for .log, .csm & .csd files, relative to location of this file
|
"buildoutput" "../../ContentBuilder/output" // build output folder for .log, .csm & .csd files, relative to location of this file
|
||||||
"contentroot" "../../" // root content folder, relative to location of this file
|
"contentroot" "../../" // root content folder, relative to location of this file
|
||||||
"setlive" "internal" // branch to set live after successful build, none if empty
|
"setlive" "internal" // branch to set live after successful build, none if empty
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"appbuild"
|
"appbuild"
|
||||||
{
|
{
|
||||||
"appid" "672870"
|
"appid" "672870"
|
||||||
"desc" "CI Build Windows"
|
"desc" "CI Build Windows {{BUILD_DESCRIPTION}}"
|
||||||
"buildoutput" "../../ContentBuilder/output" // build output folder for .log, .csm & .csd files, relative to location of this file
|
"buildoutput" "../../ContentBuilder/output" // build output folder for .log, .csm & .csd files, relative to location of this file
|
||||||
"contentroot" "../../" // root content folder, relative to location of this file
|
"contentroot" "../../" // root content folder, relative to location of this file
|
||||||
"setlive" "internal" // branch to set live after successful build, none if empty
|
"setlive" "internal" // branch to set live after successful build, none if empty
|
||||||
|
Loading…
Reference in New Issue
Block a user