From 27c456a602502a1f5fb25edc9fcbee0fddd23916 Mon Sep 17 00:00:00 2001 From: Virx Date: Wed, 6 May 2026 07:37:07 -0400 Subject: [PATCH 1/9] Add `package-rlbot.sh` --- .gitignore | 5 +- package-rlbot.sh | 306 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 310 insertions(+), 1 deletion(-) create mode 100755 package-rlbot.sh diff --git a/.gitignore b/.gitignore index 24abfb5..2d0ee8c 100644 --- a/.gitignore +++ b/.gitignore @@ -64,4 +64,7 @@ dlldata.c *.sln.iml # FlatBuffers -FlatBuffer/ \ No newline at end of file +FlatBuffer/ + +# Potential build artifacts +dist/ diff --git a/package-rlbot.sh b/package-rlbot.sh new file mode 100755 index 0000000..efd08bf --- /dev/null +++ b/package-rlbot.sh @@ -0,0 +1,306 @@ +#!/usr/bin/env bash +set -euo pipefail + +# package-rlbot.sh - Package RLBotServer binary for multiple Linux distributions +# +# Usage: ./package-rlbot.sh [distro_list] +# +# If no distribution list is provided, it defaults to packaging for ubuntu and fedora +# Supported distributions: ubuntu, fedora, arch +# +# Examples: +# ./package-rlbot.sh ./RLBotServer ubuntu +# ./package-rlbot.sh ./RLBotServer arch +# ./package-rlbot.sh ./RLBotServer # Defaults to ubuntu, fedora +# +# This script packages the RLBotServer binary for various Linux distributions, +# creating appropriate metadata and package structures. + +DEFAULT_DISTROS=("ubuntu" "fedora" "arch") + +usage() { + cat <<'EOF' +Usage: ./package-rlbot.sh [distro_list] + +If no distribution list is provided, it defaults to packaging all supported distributions. +Supported distributions: ubuntu, fedora, arch. + +Examples: + ./package-rlbot.sh ./RLBotServer ubuntu + ./package-rlbot.sh ./RLBotServer # Defaults to ubuntu, fedora, & arch + +Environment overrides: + RLBOT_RELEASE RPM release number (default: 1) + OUTPUT_DIR Output directory for packages (default: ./dist) +EOF +} + +require_cmd() { + if ! command -v "$1" >/dev/null 2>&1; then + echo "Missing required command: $1" >&2 + return 1 + fi +} + +get_git_version() { + require_cmd git + + local repo_root="$1" + local latest_tag + + latest_tag="$(git -C "$repo_root" describe --tags --abbrev=0 2>/dev/null || true)" + if [[ -z "$latest_tag" ]]; then + echo "Unable to determine version: no git tags found in $repo_root" >&2 + return 1 + fi + + echo "${latest_tag#v}" +} + +normalize_rpm_version() { + local input="$1" + + if [[ -z "$input" ]]; then + echo "RPM version is empty" >&2 + return 1 + fi + + echo "${input//-/.}" +} + +normalize_arch_version() { + local input="$1" + + if [[ -z "$input" ]]; then + echo "Arch pkgver is empty" >&2 + return 1 + fi + + echo "${input//-/.}" +} + +resolve_path() { + local input_path="$1" + local dir + dir="$(cd "$(dirname "$input_path")" && pwd)" + echo "${dir}/$(basename "$input_path")" +} + +ensure_x86_64() { + local arch_raw="$1" + case "$arch_raw" in + x86_64|amd64) + return 0 + ;; + *) + echo "Unsupported architecture: ${arch_raw}. Only x86-64 is supported." >&2 + return 1 + ;; + esac +} + +package_deb() { + require_cmd dpkg-deb + + local pkg_name="rlbotserver" + local pkg_dir="${tmp_root}/deb/${pkg_name}_${version}" + local deb_path="${out_dir}/${pkg_name}_${version}_${deb_arch}.deb" + + rm -rf "$pkg_dir" + mkdir -p "$pkg_dir/DEBIAN" "$pkg_dir/usr/local/bin" + + install -m 0755 "$binary_path" "$pkg_dir/usr/local/bin/$binary_name" + + cat > "$pkg_dir/DEBIAN/control" </dev/null + echo "Created ${deb_path}" +} + +package_rpm() { + require_cmd rpmbuild + require_cmd tar + + local pkg_name="rlbotserver" + local rpm_root="${tmp_root}/rpm" + local src_dir="${tmp_root}/${pkg_name}-${rpm_version}" + local spec_file="${rpm_root}/SPECS/${pkg_name}.spec" + + mkdir -p "${rpm_root}"/{BUILD,RPMS,SOURCES,SPECS,SRPMS} + rm -rf "$src_dir" + mkdir -p "$src_dir" + + install -m 0755 "$binary_path" "$src_dir/$binary_name" + tar -C "$tmp_root" -czf "$rpm_root/SOURCES/${pkg_name}-${rpm_version}.tar.gz" "${pkg_name}-${rpm_version}" + + cat > "$spec_file" </dev/null 2>&1 + + local rpm_file + rpm_file="$(find "$rpm_root/RPMS" -type f -name "*.rpm" | head -n 1)" + if [[ -z "$rpm_file" ]]; then + echo "RPM build failed: no package found in ${rpm_root}/RPMS" >&2 + return 1 + fi + + cp "$rpm_file" "$out_dir/" + echo "Created ${out_dir}/$(basename "$rpm_file")" +} + +package_arch() { + require_cmd tar + require_cmd zstd + require_cmd du + require_cmd date + + local pkg_name="rlbotserver" + local arch_arch="x86_64" + local arch_root="${tmp_root}/arch/${pkg_name}" + local pkgdir="${arch_root}/pkgdir" + local pkgver_full="${arch_version}-${release}" + local pkg_base_name="${pkg_name}-${arch_version}-${release}-${arch_arch}" + local pkg_tar="${tmp_root}/${pkg_base_name}.pkg.tar" + local pkg_file="${out_dir}/${pkg_base_name}.pkg.tar.zst" + + rm -rf "$arch_root" + mkdir -p "$pkgdir/usr/local/bin" + + install -m 0755 "$binary_path" "$pkgdir/usr/local/bin/$binary_name" + + local builddate + local size + builddate="$(date -u +%s)" + size="$(du -sb "$pkgdir" | awk '{print $1}')" + + cat > "$pkgdir/.PKGINFO" <&2 + exit 1 + fi + if [[ ! -x "$binary_path" ]]; then + echo "Binary is not executable: $binary_path" >&2 + exit 1 + fi + + binary_name="$(basename "$binary_path")" + + version="$(get_git_version "$script_dir")" + rpm_version="$(normalize_rpm_version "$version")" + arch_version="$(normalize_arch_version "$version")" + release="${RLBOT_RELEASE:-1}" + out_dir="${OUTPUT_DIR:-dist}" + mkdir -p "$out_dir" + + arch_raw="$(uname -m)" + ensure_x86_64 "$arch_raw" + deb_arch="amd64" + rpm_arch="x86_64" + + tmp_root="$(mktemp -d)" + trap 'rm -rf "$tmp_root"' EXIT + + for distro in "${distros[@]}"; do + distro="${distro,,}" + case "$distro" in + ubuntu) + package_deb + ;; + fedora) + package_rpm + ;; + arch) + package_arch + ;; + *) + echo "Unknown distribution: $distro" >&2 + echo "Supported distributions: ubuntu, fedora, arch" >&2 + exit 1 + ;; + esac + done +} + +main "$@" From 8d228bd4e01b4a026e1e8bba791577718975bf55 Mon Sep 17 00:00:00 2001 From: Eric Veilleux Date: Wed, 6 May 2026 07:38:53 -0400 Subject: [PATCH 2/9] Add Linux packaging to release action Added packaging step for Linux artifacts and updated release process to include .deb and .rpm files. --- .github/workflows/build.yml | 106 +++++++++++++++++++++++++----------- 1 file changed, 74 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9a339ee..8533273 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,54 +16,92 @@ jobs: NUGET_PACKAGES: D:\nuget\packages steps: - - name: Checkout - uses: actions/checkout@v6 - with: - submodules: 'recursive' + - name: Checkout + uses: actions/checkout@v6 + with: + submodules: "recursive" - - name: Test - run: dotnet test + - name: Test + run: dotnet test - - name: Build - run: dotnet publish RLBotCS -r win-x64 + - name: Build + run: dotnet publish RLBotCS -r win-x64 - - name: Upload build artifact - uses: actions/upload-artifact@v7 - with: - name: RLBotServer-windows - path: ./**/publish/RLBotServer.exe + - name: Upload build artifact + uses: actions/upload-artifact@v7 + with: + name: RLBotServer-windows + path: ./**/publish/RLBotServer.exe build-linux: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v6 - with: - submodules: 'recursive' + - name: Checkout + uses: actions/checkout@v6 + with: + submodules: "recursive" + + - name: Test + run: dotnet test + + - name: Formatting + run: | + dotnet tool restore + dotnet csharpier check . - - name: Test - run: dotnet test + - name: Build + run: dotnet publish RLBotCS -r linux-x64 - - name: Formatting - run: | - dotnet tool restore - dotnet csharpier check . + - name: Upload build artifact + uses: actions/upload-artifact@v7 + with: + name: RLBotServer-ubuntu + path: ./**/publish/RLBotServer - - name: Build - run: dotnet publish RLBotCS -r linux-x64 + package-linux: + name: Package Linux + runs-on: ubuntu-latest + if: "startsWith(github.ref, 'refs/tags/')" + needs: [build-linux] - - name: Upload build artifact - uses: actions/upload-artifact@v7 - with: - name: RLBotServer-ubuntu - path: ./**/publish/RLBotServer + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + submodules: "recursive" + fetch-depth: 0 + + - uses: actions/download-artifact@v8 + with: + merge-multiple: "true" + + - name: Install packaging dependencies + run: | + sudo apt-get update + sudo apt-get install -y rpm + + - name: Package .deb and .rpm + run: | + chmod +x ./package-rlbot.sh + BIN_PATH="$(find . -type f -name RLBotServer | head -n 1)" + if [ -z "$BIN_PATH" ]; then + echo "RLBotServer binary not found in downloaded artifacts" >&2 + exit 1 + fi + OUTPUT_DIR=dist ./package-rlbot.sh "$BIN_PATH" ubuntu fedora + + - name: Upload package artifacts + uses: actions/upload-artifact@v7 + with: + name: RLBotServer-linux-packages + path: dist/* release: name: Release runs-on: ubuntu-latest if: "startsWith(github.ref, 'refs/tags/')" - needs: [build-linux, build-windows] + needs: [build-linux, build-windows, package-linux] permissions: contents: write @@ -71,10 +109,14 @@ jobs: - uses: actions/download-artifact@v8 with: merge-multiple: "true" + - name: Publish to GitHub Releases uses: softprops/action-gh-release@v2 with: - files: ./RLBotCS/**/publish/RLBotServer* + files: | + ./RLBotCS/**/publish/RLBotServer* + ./dist/*.deb + ./dist/*.rpm generate_release_notes: true body: | Pre-built binaries that allows bots to interface with Rocket League via the RLBot v5 spec From 6f172426abdc1ee820cd7c1b24083e854d2a2f60 Mon Sep 17 00:00:00 2001 From: Eric Veilleux Date: Wed, 6 May 2026 07:41:15 -0400 Subject: [PATCH 3/9] Allow package-linux job to always run --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8533273..ca9b2a4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,7 +62,6 @@ jobs: package-linux: name: Package Linux runs-on: ubuntu-latest - if: "startsWith(github.ref, 'refs/tags/')" needs: [build-linux] steps: From 9319fa4323ec402554f351d9a53c71f466a52f12 Mon Sep 17 00:00:00 2001 From: Eric Veilleux Date: Wed, 6 May 2026 07:45:45 -0400 Subject: [PATCH 4/9] Make binary executable before packaging --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ca9b2a4..441e9a3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -88,6 +88,7 @@ jobs: echo "RLBotServer binary not found in downloaded artifacts" >&2 exit 1 fi + chmod +x "$BIN_PATH" OUTPUT_DIR=dist ./package-rlbot.sh "$BIN_PATH" ubuntu fedora - name: Upload package artifacts From 7dbb937184a8d33291811e7d988af3426f865d6a Mon Sep 17 00:00:00 2001 From: Eric Veilleux Date: Wed, 6 May 2026 07:50:44 -0400 Subject: [PATCH 5/9] Create & upload arch pkgs --- .github/workflows/build.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 441e9a3..497f23d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -80,7 +80,7 @@ jobs: sudo apt-get update sudo apt-get install -y rpm - - name: Package .deb and .rpm + - name: Generate packages run: | chmod +x ./package-rlbot.sh BIN_PATH="$(find . -type f -name RLBotServer | head -n 1)" @@ -89,7 +89,7 @@ jobs: exit 1 fi chmod +x "$BIN_PATH" - OUTPUT_DIR=dist ./package-rlbot.sh "$BIN_PATH" ubuntu fedora + OUTPUT_DIR=dist ./package-rlbot.sh "$BIN_PATH" - name: Upload package artifacts uses: actions/upload-artifact@v7 @@ -115,8 +115,9 @@ jobs: with: files: | ./RLBotCS/**/publish/RLBotServer* - ./dist/*.deb - ./dist/*.rpm + ./*.deb + ./*.rpm + ./*.pkg.tar.zst generate_release_notes: true body: | Pre-built binaries that allows bots to interface with Rocket League via the RLBot v5 spec From 5e03b0ea37c27e9185c146036ba81e49c93ce3af Mon Sep 17 00:00:00 2001 From: Eric Veilleux Date: Wed, 6 May 2026 15:08:47 -0400 Subject: [PATCH 6/9] Update build.yml to remove arch --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 497f23d..bdeaa09 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -117,7 +117,6 @@ jobs: ./RLBotCS/**/publish/RLBotServer* ./*.deb ./*.rpm - ./*.pkg.tar.zst generate_release_notes: true body: | Pre-built binaries that allows bots to interface with Rocket League via the RLBot v5 spec From eaacc8f5137f272fd107b0d8139d628e75a2cbd0 Mon Sep 17 00:00:00 2001 From: Virx Date: Wed, 6 May 2026 15:08:26 -0400 Subject: [PATCH 7/9] Remove Arch packaging support --- package-rlbot.sh | 66 +++--------------------------------------------- 1 file changed, 3 insertions(+), 63 deletions(-) diff --git a/package-rlbot.sh b/package-rlbot.sh index efd08bf..8c3f32b 100755 --- a/package-rlbot.sh +++ b/package-rlbot.sh @@ -6,17 +6,16 @@ set -euo pipefail # Usage: ./package-rlbot.sh [distro_list] # # If no distribution list is provided, it defaults to packaging for ubuntu and fedora -# Supported distributions: ubuntu, fedora, arch +# Supported distributions: ubuntu, fedora # # Examples: # ./package-rlbot.sh ./RLBotServer ubuntu -# ./package-rlbot.sh ./RLBotServer arch # ./package-rlbot.sh ./RLBotServer # Defaults to ubuntu, fedora # # This script packages the RLBotServer binary for various Linux distributions, # creating appropriate metadata and package structures. -DEFAULT_DISTROS=("ubuntu" "fedora" "arch") +DEFAULT_DISTROS=("ubuntu" "fedora") usage() { cat <<'EOF' @@ -68,17 +67,6 @@ normalize_rpm_version() { echo "${input//-/.}" } -normalize_arch_version() { - local input="$1" - - if [[ -z "$input" ]]; then - echo "Arch pkgver is empty" >&2 - return 1 - fi - - echo "${input//-/.}" -} - resolve_path() { local input_path="$1" local dir @@ -185,50 +173,6 @@ EOF echo "Created ${out_dir}/$(basename "$rpm_file")" } -package_arch() { - require_cmd tar - require_cmd zstd - require_cmd du - require_cmd date - - local pkg_name="rlbotserver" - local arch_arch="x86_64" - local arch_root="${tmp_root}/arch/${pkg_name}" - local pkgdir="${arch_root}/pkgdir" - local pkgver_full="${arch_version}-${release}" - local pkg_base_name="${pkg_name}-${arch_version}-${release}-${arch_arch}" - local pkg_tar="${tmp_root}/${pkg_base_name}.pkg.tar" - local pkg_file="${out_dir}/${pkg_base_name}.pkg.tar.zst" - - rm -rf "$arch_root" - mkdir -p "$pkgdir/usr/local/bin" - - install -m 0755 "$binary_path" "$pkgdir/usr/local/bin/$binary_name" - - local builddate - local size - builddate="$(date -u +%s)" - size="$(du -sb "$pkgdir" | awk '{print $1}')" - - cat > "$pkgdir/.PKGINFO" <&2 - echo "Supported distributions: ubuntu, fedora, arch" >&2 + echo "Supported distributions: ubuntu, fedora" >&2 exit 1 ;; esac From 1a0d04c8b2ac41e04d095de3178d7666dd8e7fb6 Mon Sep 17 00:00:00 2001 From: Virx Date: Wed, 6 May 2026 15:31:13 -0400 Subject: [PATCH 8/9] Hardcode RPM release and drop arch default --- package-rlbot.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/package-rlbot.sh b/package-rlbot.sh index 8c3f32b..7dae488 100755 --- a/package-rlbot.sh +++ b/package-rlbot.sh @@ -10,7 +10,7 @@ set -euo pipefail # # Examples: # ./package-rlbot.sh ./RLBotServer ubuntu -# ./package-rlbot.sh ./RLBotServer # Defaults to ubuntu, fedora +# ./package-rlbot.sh ./RLBotServer # Defaults to ubuntu and fedora # # This script packages the RLBotServer binary for various Linux distributions, # creating appropriate metadata and package structures. @@ -22,14 +22,13 @@ usage() { Usage: ./package-rlbot.sh [distro_list] If no distribution list is provided, it defaults to packaging all supported distributions. -Supported distributions: ubuntu, fedora, arch. +Supported distributions: ubuntu, fedora. Examples: ./package-rlbot.sh ./RLBotServer ubuntu - ./package-rlbot.sh ./RLBotServer # Defaults to ubuntu, fedora, & arch + ./package-rlbot.sh ./RLBotServer # Defaults to ubuntu and fedora Environment overrides: - RLBOT_RELEASE RPM release number (default: 1) OUTPUT_DIR Output directory for packages (default: ./dist) EOF } @@ -133,7 +132,7 @@ package_rpm() { cat > "$spec_file" < Date: Wed, 6 May 2026 17:42:26 -0400 Subject: [PATCH 9/9] Don't install to `/usr/local` --- package-rlbot.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package-rlbot.sh b/package-rlbot.sh index 7dae488..676625c 100755 --- a/package-rlbot.sh +++ b/package-rlbot.sh @@ -94,9 +94,9 @@ package_deb() { local deb_path="${out_dir}/${pkg_name}_${version}_${deb_arch}.deb" rm -rf "$pkg_dir" - mkdir -p "$pkg_dir/DEBIAN" "$pkg_dir/usr/local/bin" + mkdir -p "$pkg_dir/DEBIAN" "$pkg_dir/usr/bin" - install -m 0755 "$binary_path" "$pkg_dir/usr/local/bin/$binary_name" + install -m 0755 "$binary_path" "$pkg_dir/usr/bin/$binary_name" cat > "$pkg_dir/DEBIAN/control" <