From a667ed945f928a605a7e4c636d62d47eeb8dc6aa Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Fri, 5 Feb 2021 20:58:15 +0100 Subject: [PATCH] Add: [Actions] Automatically upload releases to Steam (#8644) --- .github/workflows/release.yml | 79 ++++++++++++++++++++++++++++++++++- os/steam/release.vdf | 57 +++++++++++++++++++++++++ 2 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 os/steam/release.vdf diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1faaacfb3c..d759d10e34 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -714,7 +714,7 @@ jobs: retention-days: 5 upload: - name: Upload + name: Upload (AWS) needs: - source - docs @@ -772,3 +772,80 @@ jobs: repository: OpenTTD/workflows event-type: ${{ needs.source.outputs.trigger_type }} client-payload: '{"version": "${{ needs.source.outputs.version }}", "folder": "${{ needs.source.outputs.folder }}"}' + + upload-steam: + name: Upload (Steam) + needs: + - source + - linux + - macos + - windows + + if: needs.source.outputs.trigger_type == 'new-master' || needs.source.outputs.trigger_type == 'new-tag' + + runs-on: ubuntu-20.04 + + steps: + - name: Download all bundles + uses: actions/download-artifact@v2 + + - name: Setup steamcmd + uses: CyberAndrii/setup-steamcmd@v1 + + - name: Generate Steam auth code + id: steam-totp + uses: CyberAndrii/steam-totp@v1 + with: + shared_secret: ${{ secrets.STEAM_SHARED_SECRET }} + + - name: Upload to Steam + run: | + echo "::group::Extracting source" + mkdir source + ( + cd source + tar -xf ../internal-source/source.tar.gz --strip-components=1 + ) + echo "::endgroup::" + + mkdir steam + ( + cd steam + + echo "::group::Prepare Win32" + unzip ../openttd-windows-x86/openttd-*-windows-win32.zip + mv openttd-*-windows-win32 steam-win32 + echo "::endgroup::" + + echo "::group::Prepare Win64" + unzip ../openttd-windows-x64/openttd-*-windows-win64.zip + mv openttd-*-windows-win64 steam-win64 + echo "::endgroup::" + + echo "::group::Prepare macOS" + mkdir steam-macos + ( + cd steam-macos + unzip ../../openttd-macos-universal/openttd-*-macos-universal.zip + ) + echo "::endgroup::" + + echo "::group::Prepare Linux" + tar xvf ../openttd-linux-generic/openttd-*-linux-generic-amd64.tar.xz + mv openttd-*-linux-generic-amd64 steam-linux + echo "::endgroup::" + + echo "::group::Preparing build file" + if [ "${{ needs.source.outputs.trigger_type }}" = "new-tag" ]; then + BRANCH="testing" + else + BRANCH="nightly" + fi + cat ../source/os/steam/release.vdf | sed 's/@@DESCRIPTION@@/openttd-${{ needs.source.outputs.version }}/;s/@@BRANCH@@/'${BRANCH}'/' > release.vdf + cat release.vdf + echo "::endgroup::" + + echo "::group::Upload to Steam" + steamcmd +login ${{ secrets.STEAM_USERNAME }} ${{ secrets.STEAM_PASSWORD }} ${{ steps.steam-totp.outputs.code }} +run_app_build $(pwd)/release.vdf +quit + echo "::endgroup::" + ) diff --git a/os/steam/release.vdf b/os/steam/release.vdf new file mode 100644 index 0000000000..ab549c3886 --- /dev/null +++ b/os/steam/release.vdf @@ -0,0 +1,57 @@ +"AppBuild" +{ + "AppID" "1536610" + "Desc" "@@DESCRIPTION@@" + + "SetLive" "@@BRANCH@@" + + "ContentRoot" "./" + "BuildOutput" "build/" + + "Depots" + { + "1536613" + { + "ContentRoot" "./steam-win32" + "FileMapping" + { + "LocalPath" "*" + "DepotPath" "." + "recursive" "1" + } + } + + "1536612" + { + "ContentRoot" "./steam-win64" + "FileMapping" + { + "LocalPath" "*" + "DepotPath" "." + "recursive" "1" + } + } + + "1536614" + { + "ContentRoot" "./steam-macos" + "FileMapping" + { + "LocalPath" "*" + "DepotPath" "." + "recursive" "1" + } + } + + "1536615" + { + "ContentRoot" "./steam-linux" + "FileMapping" + { + "LocalPath" "*" + "DepotPath" "." + "recursive" "1" + } + } + } +}