From 73a797e0ac0ad78f34a24ed895e3d090b4222a73 Mon Sep 17 00:00:00 2001 From: Mike Miller Date: Wed, 20 Oct 2021 16:21:15 +0300 Subject: [PATCH] Publish releases (and prereleases) to Steam (#182) Because Steam does not let us push releases to the main release channel ("Default"), all releases will go to the prerelease channel. Upon closing a formal version, it should be updated manually in Steam at https://partner.steamgames.com/apps/builds/1634870 To set this up, first, create a new user for Steam with limited permissions. See https://partner.steamgames.com/doc/sdk/uploading#Build_Account for details. Note that multiple users can be created with the same email address. Do NOT connect this user to the mobile steam guard; it should only use email based OTPs. After the user is created, create two github secrets: STEAM_USERNAME and STEAM_PASSWORD. Then, download steamcmd locally, and run: steamcmd +login $STEAM_USERNAME $STEAM_PASSWORD +quit It will prompt you for a code; check the email associated with the account and enter the one time password. After that, three more secrets need to be created. Check the steam directory (~/Library/Application Support/Steam on Mac, I don't know for other platforms), and run: base64 -i config/config.vdf Store this as STEAM_CONFIG_VDK Then find the file in that directory named ssfnXXXXXX. Save the file name to STEAM_SSFN_FILENAME, and the contents (using base64 -i) to STEAM_SSFN Then the builds will work! --- .github/workflows/build.yml | 70 +++++++++++++++++++ Support/steam/app.vdf.j2 | 14 ++++ ...p_template.vdf => app_template.vdf.unused} | 0 Support/steam/installscript_win.vdf | 22 +++--- Support/steam/main_depot.vdf.j2 | 32 +++++++++ ...ate.vdf => main_depot_template.vdf.unused} | 0 6 files changed, 127 insertions(+), 11 deletions(-) create mode 100644 Support/steam/app.vdf.j2 rename Support/steam/{app_template.vdf => app_template.vdf.unused} (100%) create mode 100644 Support/steam/main_depot.vdf.j2 rename Support/steam/{main_depot_template.vdf => main_depot_template.vdf.unused} (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b9ae5969c3..382a6a3cd2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -453,6 +453,76 @@ jobs: prerelease: ${{ needs.configuration.outputs.prerelease }} tag_name: ${{ needs.configuration.outputs.version }} files: releases/* + + publish_steam: + name: Publish Steam Release + needs: [configuration, build] + if: | + github.event_name == 'push' && + github.repository == 'icosa-gallery/open-brush' && + (github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags/v')) + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + lfs: true # We don't use LFS, but it adds no time, and leave it here in case we do at some point later + - name: Setup steamcmd + uses: CyberAndrii/setup-steamcmd@v1.1.1 + - name: Restore steam login config + run: | + mkdir -p /home/runner/Steam/config + echo "${{ secrets.STEAM_CONFIG_VDF}}" | base64 -d - > /home/runner/Steam/config/config.vdf + echo "${{ secrets.STEAM_SSFN }}" | base64 -d - > /home/runner/Steam/${{ secrets.STEAM_SSFN_FILENAME }} + - name: Download Build Artifacts (Windows SteamVR) + uses: actions/download-artifact@v2 + with: + name: Windows SteamVR + path: build_windows_steamvr + - name: Download Build Artifacts (Windows SteamVR Experimental) + uses: actions/download-artifact@v2 + with: + name: Windows SteamVR Experimental + path: build_windows_steamvr_experimental + - name: Upload Regular Build + run: | + pip install -U j2cli + j2 Support/steam/app.vdf.j2 > build_windows_steamvr/app.vdf + j2 Support/steam/main_depot.vdf.j2 > build_windows_steamvr/main_depot.vdf + cp Support/steam/installscript_win.vdf build_windows_steamvr/ + steamcmd +login $STEAM_USERNAME $STEAM_PASSWORD +run_app_build $(pwd)/build_windows_steamvr/app.vdf +quit + env: + STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }} + STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }} + VERSION: ${{ needs.configuration.outputs.version }} + OPEN_BRUSH_APP_ID: 1634870 + OPEN_BRUSH_WINDOWS_DEPOT_ID: 1634871 + CHANNEL: prerelease + - name: Upload Experimental Build + run: | + pip install -U j2cli + j2 Support/steam/app.vdf.j2 > build_windows_steamvr_experimental/app.vdf + j2 Support/steam/main_depot.vdf.j2 > build_windows_steamvr_experimental/main_depot.vdf + cp Support/steam/installscript_win.vdf build_windows_steamvr_experimental/ + steamcmd +login $STEAM_USERNAME $STEAM_PASSWORD +run_app_build $(pwd)/build_windows_steamvr_experimental/app.vdf +quit + env: + STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }} + STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }} + VERSION: ${{ needs.configuration.outputs.version }} + OPEN_BRUSH_APP_ID: 1634870 + OPEN_BRUSH_WINDOWS_DEPOT_ID: 1634871 + CHANNEL: prerelease-experimental + - name: Save logs + uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: steamcmd logs + path: build_output/ + + publish_oculus: name: Publish Oculus Release needs: [configuration, build] diff --git a/Support/steam/app.vdf.j2 b/Support/steam/app.vdf.j2 new file mode 100644 index 0000000000..30feefa970 --- /dev/null +++ b/Support/steam/app.vdf.j2 @@ -0,0 +1,14 @@ +"appbuild" +{ + "appid" "{{ OPEN_BRUSH_APP_ID }}" + "Desc" "{{ VERSION }}" + "buildoutput" "../build_output/{{ CHANNEL }}" // Path for steamcmd logs + "contentroot" "." // This file will be copied into the root of the release + "setlive" "{{ CHANNEL }}" + "preview" "0" // For local testing, set this to 1 + "local" "" // Not relevant; this is for a custom CDN + "depots" + { + "{{ OPEN_BRUSH_WINDOWS_DEPOT_ID }}" main_depot.vdf + } +} diff --git a/Support/steam/app_template.vdf b/Support/steam/app_template.vdf.unused similarity index 100% rename from Support/steam/app_template.vdf rename to Support/steam/app_template.vdf.unused diff --git a/Support/steam/installscript_win.vdf b/Support/steam/installscript_win.vdf index 2740035511..4e4cf09ed7 100644 --- a/Support/steam/installscript_win.vdf +++ b/Support/steam/installscript_win.vdf @@ -2,27 +2,27 @@ InstallScript { Registry { "HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\.tilt" { string { - "(Default)" "Google.TiltBrush.File" + "(Default)" "Icosa.OpenBrush.File" } } - "HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Google.TiltBrush.File" { + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Icosa.OpenBrush.File" { string { - "(Default)" "Tilt Brush sketch file" + "(Default)" "Open Brush sketch file" } } - "HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Google.TiltBrush.File\\DefaultIcon" { + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Icosa.OpenBrush.File\\DefaultIcon" { string { - "(Default)" "%INSTALLDIR%\\TiltBrush.exe" + "(Default)" "%INSTALLDIR%\\OpenBrush.exe" } } - "HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Google.TiltBrush.File\\Shell\\Open\\Command" { + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Icosa.OpenBrush.File\\Shell\\Open\\Command" { string { - "(Default)" "%WINDIR%\\System32\\WindowsPowershell\\v1.0\\powershell -windowstyle hidden -c \"try { $s=[uri]::EscapeDataString('%1'); (new-object System.Net.WebClient).DownloadString('http://localhost:40074/load?'+$s) } catch { & '%INSTALLDIR%\\TiltBrush.exe' '%1' }\"" + "(Default)" "%WINDIR%\\System32\\WindowsPowershell\\v1.0\\powershell -windowstyle hidden -c \"try { $s=[uri]::EscapeDataString('%1'); (new-object System.Net.WebClient).DownloadString('http://localhost:40074/load?'+$s) } catch { & '%INSTALLDIR%\\OpenBrush.exe' '%1' }\"" } } "HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\tiltbrush" { string { - "(Default)" "URL:Tilt Brush" + "(Default)" "URL:Open Brush" } string { "URL Protocol" "" @@ -30,17 +30,17 @@ InstallScript { } "HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\tiltbrush\\DefaultIcon" { string { - "(Default)" "%INSTALLDIR%\\TiltBrush.exe" + "(Default)" "%INSTALLDIR%\\OpenBrush.exe" } } "HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\tiltbrush\\Shell\\Open\\Command" { string { - "(Default)" "%WINDIR%\\System32\\WindowsPowershell\\v1.0\\powershell -windowstyle hidden -c \"try { $s=[uri]::EscapeDataString('%1'); (new-object System.Net.WebClient).DownloadString('http://localhost:40074/load?'+$s) } catch { & '%INSTALLDIR%\\TiltBrush.exe' '%1' }\"" + "(Default)" "%WINDIR%\\System32\\WindowsPowershell\\v1.0\\powershell -windowstyle hidden -c \"try { $s=[uri]::EscapeDataString('%1'); (new-object System.Net.WebClient).DownloadString('http://localhost:40074/load?'+$s) } catch { & '%INSTALLDIR%\\OpenBrush.exe' '%1' }\"" } } } Firewall { - "Tilt Brush" "%INSTALLDIR%\\TiltBrush.exe" + "Open Brush" "%INSTALLDIR%\\OpenBrush.exe" } } diff --git a/Support/steam/main_depot.vdf.j2 b/Support/steam/main_depot.vdf.j2 new file mode 100644 index 0000000000..6561a9ef08 --- /dev/null +++ b/Support/steam/main_depot.vdf.j2 @@ -0,0 +1,32 @@ +"DepotBuildConfig" +{ + // # Set your assigned depot ID here + "DepotID" "{{ OPEN_BRUSH_WINDOWS_DEPOT_ID }}" + + "ContentRoot" "StandaloneWindows64-SteamVR" + + "FileMapping" + { + // Include all files in the build output directory (ContentRoot) + "LocalPath" "*" + + // Destination is the main install directory + "DepotPath" "." + + // If LocalPath contains wildcards, setting this means that all + // matching files within subdirectories of LocalPath will also + // be included. + "recursive" "1" + } + + // Install scripts + "FileMapping" { + "LocalPath" "../installscript_win.vdf" + "DepotPath" "." + } + "InstallScript" "../installscript_win.vdf" + + // but exclude all symbol files + "FileExclusion" "*.pdb" + "FileExclusion" "build_log.txt" +} diff --git a/Support/steam/main_depot_template.vdf b/Support/steam/main_depot_template.vdf.unused similarity index 100% rename from Support/steam/main_depot_template.vdf rename to Support/steam/main_depot_template.vdf.unused