load("@rules_pkg//:pkg.bzl", "pkg_tar") pkg_tar( name = "rules_rust", srcs = ["//:distro"], extension = "tar.gz", mode = "0444", # Make it owned by root so it does not have the uid of the CI robot. owner = "0.0", package_dir = ".", strip_prefix = ".", visibility = ["//:__subpackages__"], ) # This filegroup allows the tar file to appear in runfiles # https://github.com/bazelbuild/bazel/issues/12348 filegroup( name = "distro", srcs = [":rules_rust"], visibility = ["//:__subpackages__"], ) sh_binary( name = "publish", srcs = ["publisher.sh"], data = [":distro"], env = {"ARCHIVE": "$(rootpath :distro)"}, target_compatible_with = select({ "@platforms//os:linux": [], "@platforms//os:macos": [], "//conditions:default": ["@platforms//:incompatible"], }), )