Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
79 changes: 78 additions & 1 deletion .github/workflows/release.yml
Expand Up @@ -714,7 +714,7 @@ jobs:
retention-days: 5

upload:
name: Upload
name: Upload (AWS)
needs:
- source
- docs
Expand Down Expand Up @@ -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 changes: 57 additions & 0 deletions 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"
}
}
}
}