diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5dea7c9f40..bc0225153f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -107,3 +107,19 @@ jobs: with: version: ${{ needs.source.outputs.version }} trigger_type: ${{ needs.source.outputs.trigger_type }} + + upload-gog: + name: Upload (GOG) + needs: + - source + - linux + - macos + - windows + + if: needs.source.outputs.trigger_type == 'new-tag' + + uses: ./.github/workflows/upload-gog.yml + secrets: inherit + + with: + version: ${{ needs.source.outputs.version }} diff --git a/.github/workflows/upload-gog.yml b/.github/workflows/upload-gog.yml new file mode 100644 index 0000000000..b4a591fdcc --- /dev/null +++ b/.github/workflows/upload-gog.yml @@ -0,0 +1,124 @@ +name: Upload (GOG) + +on: + workflow_call: + inputs: + version: + required: true + type: string + +jobs: + upload: + name: Upload (GOG) + + runs-on: ubuntu-20.04 + + steps: + - name: Download all bundles + uses: actions/download-artifact@v3 + + - name: Install GOG Galaxy Build Creator + run: | + wget https://cdn.gog.com/open/galaxy/pipeline/build_creator/gnu-linux/GOGGalaxyBuildCreator-1.4.0.AppImage + 7z x GOGGalaxyBuildCreator-1.4.0.AppImage + chmod +x ./app/GOGGalaxyPipelineBuilder + + - name: Install OpenGFX + shell: bash + run: | + mkdir -p gog/opengfx/baseset + cd gog/opengfx/baseset + + echo "::group::Download OpenGFX" + curl -L https://cdn.openttd.org/opengfx-releases/7.1/opengfx-7.1-all.zip -o opengfx-all.zip + echo "::endgroup::" + + echo "::group::Unpack OpenGFX" + unzip opengfx-all.zip + echo "::endgroup::" + + rm -f opengfx-all.zip + + - name: Install OpenMSX + shell: bash + run: | + mkdir -p gog/openmsx/baseset + cd gog/openmsx/baseset + + echo "::group::Download OpenMSX" + curl -L https://cdn.openttd.org/openmsx-releases/0.4.2/openmsx-0.4.2-all.zip -o openmsx-all.zip + echo "::endgroup::" + + echo "::group::Unpack OpenGFX" + unzip openmsx-all.zip + tar xf openmsx-*.tar + echo "::endgroup::" + + rm -f openmsx-all.zip openmsx-*.tar + + - name: Install OpenSFX + shell: bash + run: | + mkdir -p gog/opensfx/baseset + cd gog/opensfx/baseset + + echo "::group::Download OpenSFX" + curl -L https://cdn.openttd.org/opensfx-releases/1.0.3/opensfx-1.0.3-all.zip -o opensfx-all.zip + echo "::endgroup::" + + echo "::group::Unpack OpenSFX" + unzip opensfx-all.zip + tar xf opensfx-*.tar + echo "::endgroup::" + + rm -f opensfx-all.zip opensfx-*.tar + + - name: Upload to GOG + run: | + echo "::group::Extracting source" + mkdir source + ( + cd source + tar -xf ../internal-source/source.tar.gz --strip-components=1 + ) + echo "::endgroup::" + + ( + cd gog + + echo "::group::Prepare Win32" + unzip ../openttd-windows-x86/openttd-*-windows-win32.zip + mv openttd-*-windows-win32 win32 + echo "::endgroup::" + + echo "::group::Prepare Win64" + unzip ../openttd-windows-x64/openttd-*-windows-win64.zip + mv openttd-*-windows-win64 win64 + echo "::endgroup::" + + echo "::group::Prepare macOS" + mkdir macos + ( + cd 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 linux + echo "::endgroup::" + + echo "::group::Preparing build files" + cp ../source/os/gog/*.json . + for json in $(ls *.json); do + sed -i 's/VERSION/${{ inputs.version }}/g;s/CLIENT_ID/${{ secrets.GOG_CLIENT_ID }}/g;s/CLIENT_SECRET/${{ secrets.GOG_CLIENT_SECRET }}/g' ${json} + done + echo "::endgroup::" + + echo "::group::Upload to GOG" + ../app/GOGGalaxyPipelineBuilder build-game --username "${{ secrets.GOG_USERNAME }}" --password "${{ secrets.GOG_PASSWORD }}" --branch Testing windows.json + ../app/GOGGalaxyPipelineBuilder build-game --username "${{ secrets.GOG_USERNAME }}" --password "${{ secrets.GOG_PASSWORD }}" --branch Testing macos.json + ../app/GOGGalaxyPipelineBuilder build-game --username "${{ secrets.GOG_USERNAME }}" --password "${{ secrets.GOG_PASSWORD }}" --branch Testing linux.json + echo "::endgroup::" + ) diff --git a/os/gog/linux.json b/os/gog/linux.json new file mode 100755 index 0000000000..47e80fd255 --- /dev/null +++ b/os/gog/linux.json @@ -0,0 +1,64 @@ +{ + "project": { + "baseProductId": "1293297882", + "clientId": "CLIENT_ID", + "clientSecret": "CLIENT_SECRET", + "version": "VERSION", + "installDirectory": "OpenTTD", + "name": "OpenTTD", + "platform": "gnu-linux", + "tags": [ + "editor_v_1_4_0" + ], + "languageMode": "together", + "products": [ + { + "name": "OpenTTD", + "productId": "1293297882", + "depots": [ + { + "name": "Linux", + "folder": "linux", + "languages": [ + "en-US" + ] + }, + { + "name": "OpenGFX", + "folder": "opengfx", + "languages": [ + "en-US" + ] + }, + { + "name": "OpenMSX", + "folder": "openmsx", + "languages": [ + "en-US" + ] + }, + { + "name": "OpenSFX", + "folder": "opensfx", + "languages": [ + "en-US" + ] + } + ], + "tasks": [ + { + "type": "FileTask", + "name": "OpenTTD", + "languages": [ + "en-US" + ], + "category": "game", + "path": "openttd", + "isPrimary": true + } + ], + "supportDepots": [] + } + ] + } +} diff --git a/os/gog/macos.json b/os/gog/macos.json new file mode 100755 index 0000000000..8ce9a02be7 --- /dev/null +++ b/os/gog/macos.json @@ -0,0 +1,65 @@ +{ + "project": { + "baseProductId": "1293297882", + "clientId": "CLIENT_ID", + "clientSecret": "CLIENT_SECRET", + "version": "VERSION", + "installDirectory": "OpenTTD", + "name": "OpenTTD", + "platform": "osx", + "tags": [ + "editor_v_1_4_0" + ], + "languageMode": "together", + "products": [ + { + "name": "OpenTTD", + "productId": "1293297882", + "depots": [ + { + "name": "MacOS", + "folder": "macos", + "languages": [ + "en-US" + ] + }, + { + "name": "OpenGFX", + "folder": "opengfx", + "languages": [ + "en-US" + ] + }, + { + "name": "OpenMSX", + "folder": "openmsx", + "languages": [ + "en-US" + ] + }, + { + "name": "OpenSFX", + "folder": "opensfx", + "languages": [ + "en-US" + ] + } + ], + "tasks": [ + { + "type": "FileTask", + "name": "OpenTTD", + "languages": [ + "en-US" + ], + "category": "game", + "path": "OpenTTD.app/Contents/MacOS/openttd", + "isPrimary": true + } + ], + "supportDepots": [] + } + ] + } +} + diff --git a/os/gog/windows.json b/os/gog/windows.json new file mode 100755 index 0000000000..8582abb060 --- /dev/null +++ b/os/gog/windows.json @@ -0,0 +1,94 @@ +{ + "project": { + "baseProductId": "1293297882", + "clientId": "CLIENT_ID", + "clientSecret": "CLIENT_SECRET", + "version": "VERSION", + "installDirectory": "OpenTTD", + "name": "OpenTTD", + "platform": "windows", + "tags": [ + "editor_v_1_4_0" + ], + "languageMode": "together", + "products": [ + { + "name": "OpenTTD", + "productId": "1293297882", + "depots": [ + { + "name": "Win32", + "folder": "win32", + "languages": [ + "en-US" + ], + "osBitness": [ + "32" + ] + }, + { + "name": "Win64", + "folder": "win64", + "languages": [ + "en-US" + ], + "osBitness": [ + "64" + ] + }, + { + "name": "OpenGFX", + "folder": "opengfx", + "languages": [ + "en-US" + ], + "osBitness": [ + "32", + "64" + ] + }, + { + "name": "OpenMSX", + "folder": "openmsx", + "languages": [ + "en-US" + ], + "osBitness": [ + "32", + "64" + ] + }, + { + "name": "OpenSFX", + "folder": "opensfx", + "languages": [ + "en-US" + ], + "osBitness": [ + "32", + "64" + ] + } + ], + "tasks": [ + { + "type": "FileTask", + "name": "OpenTTD", + "languages": [ + "en-US" + ], + "category": "game", + "path": "openttd.exe", + "isPrimary": true, + "osBitness": [ + "32", + "64" + ] + } + ], + "supportDepots": [] + } + ], + "scriptInterpreter": true + } +}