diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 83daf0fd..32e0f4e2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -483,3 +483,59 @@ jobs: target_commitish: ${{ needs.configuration.outputs.currentrelease }} tag_name: ${{ needs.configuration.outputs.version }} files: releases/* + + publish_steam: + name: Publish Steam Release + needs: [build] + if: | + github.event_name == 'push' && + github.repository == 'icosa-foundation/open-blocks' && + (github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags/v')) + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + sparse-checkout: | + Support/steam + 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.2.0 + - 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 + md5sum /home/runner/Steam/config/config.vdf + - name: Download Build Artifacts (Windows) + uses: actions/download-artifact@v4 + with: + name: Windows + path: build_windows + - name: Upload Build + run: | + pip install -U jinjanator + jinjanate Support/steam/app.vdf.j2 > app.vdf + jinjanate Support/steam/main_depot.win.vdf.j2 > build_windows/main_depot.vdf + #jinjanate Support/steam/installscript_win.vdf.j2 > build_windows_openxr/installscript_win.vdf + steamcmd +login $STEAM_USERNAME +run_app_build $(pwd)/app.vdf +quit + env: + STEAM_USERNAME: ${{ vars.STEAM_USERNAME }} + STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }} + VERSION: ${{ needs.configuration.outputs.version }} + OPEN_BLOCKS_APP_ID: ${{ vars.STEAM_APP_ID }} + OPEN_BLOCKS_WINDOWS_DEPOT_ID: ${{ vars.STEAM_WINDOWS_DEPOT_ID }} + OPEN_BLOCKS_WINDOWS_EXECUTABLE: ${{ needs.configuration.outputs.basename}}.exe + CHANNEL: beta + - name: Update steam login secret + run: | + base64 -i /home/runner/Steam/config/config.vdf | gh secret set --visibility all --org icosa-foundation STEAM_CONFIG_VDF + md5sum /home/runner/Steam/config/config.vdf + env: + GITHUB_TOKEN: ${{ secrets.SECRET_UPDATER_PAT }} + - name: Save logs + uses: actions/upload-artifact@v4 + if: ${{ failure() }} + with: + name: steamcmd logs + path: build_output/ diff --git a/Support/steam/app.vdf.j2 b/Support/steam/app.vdf.j2 new file mode 100644 index 00000000..d0e5779d --- /dev/null +++ b/Support/steam/app.vdf.j2 @@ -0,0 +1,14 @@ +"appbuild" +{ + "appid" "{{ OPEN_BLOCKS_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_BLOCKS_WINDOWS_DEPOT_ID }}" build_windows/main_depot.vdf + } +} diff --git a/Support/steam/main_depot.win.vdf.j2 b/Support/steam/main_depot.win.vdf.j2 new file mode 100644 index 00000000..96f082c7 --- /dev/null +++ b/Support/steam/main_depot.win.vdf.j2 @@ -0,0 +1,32 @@ +"DepotBuildConfig" +{ + // # Set your assigned depot ID here + "DepotID" "{{ OPEN_BLOCKS_WINDOWS_DEPOT_ID }}" + + "ContentRoot" "build_windows/StandaloneWindows64" + + "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" +}