Add: [Actions] Automatically upload releases to Steam (#8644)

This commit is contained in:
Patric Stout 2021-02-05 20:58:15 +01:00 committed by GitHub
parent 05df7996a4
commit a667ed945f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 135 additions and 1 deletions

View File

@ -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::"
)

57
os/steam/release.vdf Normal file
View File

@ -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"
}
}
}
}