These rules make Steam applications available as Bazel repositories.
Limitations:
- Authentication is not supported so only free-to-download apps may be used
- External automation is required for application updates
bazel_dep(name = "rules_steam")
git_override(
module_name = "rules_steam",
commit = "...",
remote = "https://github.com/lanofdoom/rules_steam.git",
)Create update-steamapps.sh script
#!/bin/bash -ue
cd $(dirname $0)
bazel run @rules_steam//generate -- --app 42 --repo my_game_server --out $(pwd)/steamapps.bzl
bazel mod depsThis script generates a bazel module extension file that will create repositories containing Steam apps.
Pass --files (repeatable) to limit what gets downloaded, e.g. --files 'regex:^srcds_linux64$' --files 'regex:^bin/linux64/libsteam_api\.so$'. Each value becomes a DepotDownloader -filelist entry (a path, or a regex:-prefixed pattern) and is applied to every depot in the generated file.
steamapps = use_extension("//:steamapps.bzl", "steamapps_bzlmod")
use_repo(steamapps, "my_game_server")Once configured, these rules produce pkg_files targets available like @my_game_server//:files.
Those rules can be used to produce any of the other rules_pkg package formats for further use. For example:
pkg_tar(
name = "my_game_server",
srcs = ["@my_game_server//:files"],
package_dir = "/opt/scpsl",
)Configure automation to periodically run the update script and commit the results.
See update-example.yml for one approach. For annoying reasons, this requires permissions beyond the standard GITHUB_TOKEN, so a personal or application token must be used as explained in the GitHub Docs.