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
This commit is contained in:
14
.github/workflows/rust-release.yml
vendored
14
.github/workflows/rust-release.yml
vendored
@@ -117,10 +117,11 @@ jobs:
|
|||||||
dest="dist/${{ matrix.target }}"
|
dest="dist/${{ matrix.target }}"
|
||||||
|
|
||||||
# For compatibility with environments that lack the `zstd` tool we
|
# For compatibility with environments that lack the `zstd` tool we
|
||||||
# additionally create a `.tar.gz` alongside every single binary that
|
# additionally create a `.tar.gz` for all platforms and `.zip` for
|
||||||
# we publish. The end result is:
|
# Windows alongside every single binary that we publish. The end result is:
|
||||||
# codex-<target>.zst (existing)
|
# codex-<target>.zst (existing)
|
||||||
# codex-<target>.tar.gz (new)
|
# codex-<target>.tar.gz (new)
|
||||||
|
# codex-<target>.zip (only for Windows)
|
||||||
|
|
||||||
# 1. Produce a .tar.gz for every file in the directory *before* we
|
# 1. Produce a .tar.gz for every file in the directory *before* we
|
||||||
# run `zstd --rm`, because that flag deletes the original files.
|
# run `zstd --rm`, because that flag deletes the original files.
|
||||||
@@ -128,13 +129,20 @@ jobs:
|
|||||||
base="$(basename "$f")"
|
base="$(basename "$f")"
|
||||||
# Skip files that are already archives (shouldn't happen, but be
|
# Skip files that are already archives (shouldn't happen, but be
|
||||||
# safe).
|
# safe).
|
||||||
if [[ "$base" == *.tar.gz ]]; then
|
if [[ "$base" == *.tar.gz || "$base" == *.zip ]]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create per-binary tar.gz
|
# Create per-binary tar.gz
|
||||||
tar -C "$dest" -czf "$dest/${base}.tar.gz" "$base"
|
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
|
# Also create .zst (existing behaviour) *and* remove the original
|
||||||
# uncompressed binary to keep the directory small.
|
# uncompressed binary to keep the directory small.
|
||||||
zstd -T0 -19 --rm "$dest/$base"
|
zstd -T0 -19 --rm "$dest/$base"
|
||||||
|
|||||||
Reference in New Issue
Block a user