changeset 966:a3428760e483

fix: steamcmd not executable, implement steam-upload
author sam <sam@basx.dev>
date Wed, 03 Apr 2024 15:00:40 +0700
parents 7e164048c85c
children 2f9469f83796
files semicongine/build.nim tools/steamcmd.zip
diffstat 2 files changed, 17 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/semicongine/build.nim	Wed Apr 03 13:02:41 2024 +0700
+++ b/semicongine/build.nim	Wed Apr 03 15:00:40 2024 +0700
@@ -8,6 +8,8 @@
 import ./core/constants
 
 const BLENDER_CONVERT_SCRIPT = currentSourcePath().parentDir().parentDir().joinPath("tools/blender_gltf_converter.py")
+const STEAMCMD_ZIP = currentSourcePath().parentDir().parentDir().joinPath("tools/steamcmd.zip")
+const STEAM_DIR_NAME = "steam"
 
 proc semicongine_builddir*(buildname: string, builddir = "./build"): string =
   var platformDir = "unkown"
@@ -32,15 +34,15 @@
 proc semicongine_pack*(outdir: string, bundleType: string, resourceRoot: string) =
   switch("define", "PACKAGETYPE=" & bundleType)
 
-  rmDir(outdir)
-  mkDir(outdir)
+  outdir.rmDir()
+  outdir.mkDir()
 
   echo "BUILD: Packing assets from '" & resourceRoot & "' into directory '" & outdir & "'"
   let outdir_resources = joinPath(outdir, RESOURCEROOT)
   if bundleType == "dir":
     cpDir(resourceRoot, outdir_resources)
   elif bundleType == "zip":
-    mkDir(outdir_resources)
+    outdir_resources.mkDir()
     for resource in listDirs(resourceRoot):
       let outputfile = joinPath(outdir_resources, resource.splitPath().tail & ".zip")
       withdir resource:
@@ -112,12 +114,21 @@
   import_meshes meshfiles
   import_audio audiofiles
 
-const STEAM_DIR_NAME = "steamcmd"
 
-proc semicongine_steam*() =
+# for steam-buildscript docs see https://partner.steamgames.com/doc/sdk/uploading
+proc semicongine_steam_upload*(steamaccount, password, buildscript: string) =
   if not defined(linux):
-    echo "steam builds must be done on linux for now"
+    echo "steam uploads must be done on linux for now"
     return
 
   let steamdir = thisDir().joinPath(STEAM_DIR_NAME)
   if not dirExists(steamdir):
+    steamdir.mkDir
+    let zipFilename = STEAMCMD_ZIP.extractFilename
+    STEAMCMD_ZIP.cpFile(steamdir.joinPath(zipFilename))
+    withDir(steamdir):
+      exec &"unzip {zipFilename}"
+      rmFile zipFilename
+      exec "steamcmd/steamcmd.sh +quit" # self-update steamcmd
+
+  exec f"steamcmd/steamcmd.sh +login \"{steamaccount}\" \"{password}\" +run_app_build {buildscript} +quit"
Binary file tools/steamcmd.zip has changed