Skip to content

Commit a4bfdf6

Browse files
authored
chore: produce .tar.gz versions of artifacts in addition to .zst (#1036)
For sparse containers/environments that do not have `zstd`, provide `.tar.gz` as alternative archive format.
1 parent 44022db commit a4bfdf6

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

.github/workflows/rust-release.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,42 @@ jobs:
115115
- name: Compress artifacts
116116
shell: bash
117117
run: |
118+
# Path that contains the uncompressed binaries for the current
119+
# ${{ matrix.target }}
118120
dest="dist/${{ matrix.target }}"
119-
zstd -T0 -19 --rm "$dest"/*
121+
122+
# For compatibility with environments that lack the `zstd` tool we
123+
# additionally create a `.tar.gz` alongside every single binary that
124+
# we publish. The end result is:
125+
# codex-<target>.zst (existing)
126+
# codex-<target>.tar.gz (new)
127+
# ...same naming for codex-exec-* and codex-linux-sandbox-*
128+
129+
# 1. Produce a .tar.gz for every file in the directory *before* we
130+
# run `zstd --rm`, because that flag deletes the original files.
131+
for f in "$dest"/*; do
132+
base="$(basename "$f")"
133+
# Skip files that are already archives (shouldn't happen, but be
134+
# safe).
135+
if [[ "$base" == *.tar.gz ]]; then
136+
continue
137+
fi
138+
139+
# Create per-binary tar.gz
140+
tar -C "$dest" -czf "$dest/${base}.tar.gz" "$base"
141+
142+
# Also create .zst (existing behaviour) *and* remove the original
143+
# uncompressed binary to keep the directory small.
144+
zstd -T0 -19 --rm "$dest/$base"
145+
done
120146
121147
- uses: actions/upload-artifact@v4
122148
with:
123149
name: ${{ matrix.target }}
124-
path: codex-rs/dist/${{ matrix.target }}/*
150+
# Upload the per-binary .zst files as well as the new .tar.gz
151+
# equivalents we generated in the previous step.
152+
path: |
153+
codex-rs/dist/${{ matrix.target }}/*
125154
126155
release:
127156
needs: build

0 commit comments

Comments
 (0)