name: Release (Linux, Dedicated) on: workflow_call: inputs: survey_key: required: false type: string default: "" jobs: linux: name: Linux (Dedicated) runs-on: ubuntu-latest container: # manylinux_2_28 is based on AlmaLinux 8, and already has a lot of things # installed and preconfigured. It makes it easier to build OpenTTD. # This distro is based on glibc 2.28, released in 2018. image: quay.io/pypa/manylinux_2_28_x86_64 steps: - name: Download source uses: actions/download-artifact@v4 with: name: internal-source - name: Unpack source run: | tar -xf source.tar.gz --strip-components=1 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable - name: Enable Rust cache uses: Swatinem/rust-cache@v2 - name: Setup vcpkg caching uses: actions/github-script@v7 with: script: | core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite') - name: Install dependencies run: | echo "::group::Install system dependencies" # perl-IPC-Cmd, wget, and zip are needed to run vcpkg. # autoconf-archive is needed to build ICU. yum install -y \ autoconf-archive \ perl-IPC-Cmd \ wget \ zip \ # EOF # aclocal looks first in /usr/local/share/aclocal, and if that doesn't # exist only looks in /usr/share/aclocal. We have files in both that # are important. So copy the latter to the first, and we are good to # go. cp /usr/share/aclocal/* /usr/local/share/aclocal/ echo "::endgroup::" # We use vcpkg for our dependencies, to get more up-to-date version. echo "::group::Install vcpkg and dependencies" git clone https://github.com/microsoft/vcpkg /vcpkg ( cd /vcpkg ./bootstrap-vcpkg.sh -disableMetrics ) - name: Patch bundle name run: | sed -i 's/generic/dedicated/g' cmake/InstallAndPackage.cmake - name: Build run: | mkdir -p build cd build echo "::group::CMake" cmake ${GITHUB_WORKSPACE} \ -DCMAKE_TOOLCHAIN_FILE=/vcpkg/scripts/buildsystems/vcpkg.cmake \ -DCMAKE_BUILD_TYPE=Release \ -DOPTION_DEDICATED=ON \ -DOPTION_COMPRESS_DEBUG=ON \ -DOPTION_LTO=ON \ -DOPTION_TRIM_PATH_PREFIX=ON \ -DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \ -DOPTION_PACKAGE_DEPENDENCIES=ON \ # EOF echo "::endgroup::" echo "::group::Build" echo "Running on $(nproc) cores" cmake --build . -j $(nproc) --target openttd echo "::endgroup::" - name: Create bundles run: | cd ${GITHUB_WORKSPACE}/build echo "::group::Run CPack" cpack echo "::endgroup::" echo "::group::Cleanup" # Remove the sha256 files CPack generates; we will do this ourself at # the end of this workflow. rm -f bundles/*.sha256 echo "::endgroup::" - name: Store bundles uses: actions/upload-artifact@v4 with: name: openttd-linux-dedicated path: build/bundles retention-days: 5