From 5fb37bfbaf4a9ad8ff1a82c1c5610357389e8ed4 Mon Sep 17 00:00:00 2001 From: IgorRachkov <89467086+igor04091968@users.noreply.github.com> Date: Sun, 14 Jun 2026 16:56:48 +0300 Subject: [PATCH] ci: add binary package path compatibility aliases --- scripts/package_rust_release_binaries.py | 27 +++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/scripts/package_rust_release_binaries.py b/scripts/package_rust_release_binaries.py index 7265226..9e9e469 100644 --- a/scripts/package_rust_release_binaries.py +++ b/scripts/package_rust_release_binaries.py @@ -49,6 +49,30 @@ def write(path: Path, text: str) -> None: path.write_text(text, encoding="utf-8") +def write_archive_checksum(archive: Path) -> None: + write(archive.with_suffix(archive.suffix + ".sha256"), f"{sha256(archive)} {archive.name}\n") + + +def create_compatibility_aliases(out_dir: Path, archive: Path) -> None: + """Create both linux-x86_64 and linux_x86_64 artifact paths. + + Older workflow edits used the underscore form while the target name uses the + hyphen form. Keeping both names makes the artifact packaging tolerant to + either path without changing the release contents. + """ + out_alias = Path(str(out_dir).replace("linux-x86_64", "linux_x86_64")) + if out_alias != out_dir: + if out_alias.exists(): + shutil.rmtree(out_alias) + shutil.copytree(out_dir, out_alias) + + archive_alias = Path(str(archive).replace("linux-x86_64", "linux_x86_64")) + if archive_alias != archive: + archive_alias.parent.mkdir(parents=True, exist_ok=True) + shutil.copy2(archive, archive_alias) + write_archive_checksum(archive_alias) + + def main() -> None: parser = argparse.ArgumentParser() parser.add_argument("--release-dir", type=Path, required=True) @@ -100,7 +124,8 @@ def main() -> None: archive.parent.mkdir(parents=True, exist_ok=True) with tarfile.open(archive, "w:gz") as tar: tar.add(out_dir, arcname=out_dir.name) - write(archive.with_suffix(archive.suffix + ".sha256"), f"{sha256(archive)} {archive.name}\n") + write_archive_checksum(archive) + create_compatibility_aliases(out_dir, archive) if __name__ == "__main__":