From 5b1989f4d781e497e62b20cdc4cee8a568d0e0e7 Mon Sep 17 00:00:00 2001 From: UnownPlain <38232575+UnownPlain@users.noreply.github.com> Date: Mon, 18 Aug 2025 20:43:19 -0400 Subject: [PATCH] Release zip archived binaries (#2438) Adds zip archives to release workflow to improve compatibility (mainly older versions Windows which don't support `tar.gz` or `.zst` out of the box). Test release: https://github.com/UnownPlain/codex/releases/tag/rust-v0.0.0 Test run: https://github.com/UnownPlain/codex/actions/runs/16981943609 --- .github/workflows/rust-release.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust-release.yml b/.github/workflows/rust-release.yml index d3e313b3c..c30ffdf61 100644 --- a/.github/workflows/rust-release.yml +++ b/.github/workflows/rust-release.yml @@ -117,10 +117,11 @@ jobs: dest="dist/${{ matrix.target }}" # For compatibility with environments that lack the `zstd` tool we - # additionally create a `.tar.gz` alongside every single binary that - # we publish. The end result is: + # additionally create a `.tar.gz` for all platforms and `.zip` for + # Windows alongside every single binary that we publish. The end result is: # codex-.zst (existing) # codex-.tar.gz (new) + # codex-.zip (only for Windows) # 1. Produce a .tar.gz for every file in the directory *before* we # run `zstd --rm`, because that flag deletes the original files. @@ -128,13 +129,20 @@ jobs: base="$(basename "$f")" # Skip files that are already archives (shouldn't happen, but be # safe). - if [[ "$base" == *.tar.gz ]]; then + if [[ "$base" == *.tar.gz || "$base" == *.zip ]]; then continue fi # Create per-binary tar.gz tar -C "$dest" -czf "$dest/${base}.tar.gz" "$base" + # Create zip archive for Windows binaries + # Must run from inside the dest dir so 7z won't + # embed the directory path inside the zip. + if [[ "${{ matrix.runner }}" == windows* ]]; then + (cd "$dest" && 7z a "${base}.zip" "$base") + fi + # Also create .zst (existing behaviour) *and* remove the original # uncompressed binary to keep the directory small. zstd -T0 -19 --rm "$dest/$base"