mirror of
https://github.com/openai/codex.git
synced 2026-05-24 13:04:29 +00:00
## Summary DotSlash should resolve the same canonical package archives used by standalone installers and npm platform packages, rather than continuing to point at single-binary zstd artifacts or the older Linux bundle archive. This updates the Codex CLI and `codex-app-server` DotSlash release config entries to match `codex-package-<target>.tar.gz` and `codex-app-server-package-<target>.tar.gz`, with paths that select `bin/codex` or `bin/codex-app-server` inside the extracted package. The other helper outputs stay on their existing per-binary artifacts for now. ## Test plan - `python3 -m json.tool .github/dotslash-config.json > /dev/null` - Ran a Python regex smoke test that checked every updated `codex` and `codex-app-server` platform entry against the archive names emitted by `.github/scripts/build-codex-package-archive.sh`.
119 lines
2.6 KiB
Bash
119 lines
2.6 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
usage() {
|
|
cat <<'EOF'
|
|
Usage: build-codex-package-archive.sh \
|
|
--target <rust-target> \
|
|
--bundle <primary|app-server> \
|
|
--entrypoint-dir <dir> \
|
|
--archive-dir <dir> \
|
|
[--target-suffixed-entrypoint]
|
|
EOF
|
|
}
|
|
|
|
target=""
|
|
bundle=""
|
|
entrypoint_dir=""
|
|
archive_dir=""
|
|
target_suffixed_entrypoint="false"
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--target)
|
|
target="${2:?--target requires a value}"
|
|
shift 2
|
|
;;
|
|
--bundle)
|
|
bundle="${2:?--bundle requires a value}"
|
|
shift 2
|
|
;;
|
|
--entrypoint-dir)
|
|
entrypoint_dir="${2:?--entrypoint-dir requires a value}"
|
|
shift 2
|
|
;;
|
|
--archive-dir)
|
|
archive_dir="${2:?--archive-dir requires a value}"
|
|
shift 2
|
|
;;
|
|
--target-suffixed-entrypoint)
|
|
target_suffixed_entrypoint="true"
|
|
shift
|
|
;;
|
|
-h|--help)
|
|
usage
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo "Unexpected argument: $1" >&2
|
|
usage >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [[ -z "$target" || -z "$bundle" || -z "$entrypoint_dir" || -z "$archive_dir" ]]; then
|
|
usage >&2
|
|
exit 1
|
|
fi
|
|
|
|
case "$bundle" in
|
|
primary)
|
|
variant="codex"
|
|
entrypoint="codex"
|
|
archive_stem="codex-package"
|
|
;;
|
|
app-server)
|
|
variant="codex-app-server"
|
|
entrypoint="codex-app-server"
|
|
archive_stem="codex-app-server-package"
|
|
;;
|
|
*)
|
|
echo "No Codex package variant for bundle: $bundle" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exe_suffix=""
|
|
case "$target" in
|
|
*windows*)
|
|
exe_suffix=".exe"
|
|
;;
|
|
esac
|
|
|
|
entrypoint_name="$entrypoint"
|
|
if [[ "$target_suffixed_entrypoint" == "true" ]]; then
|
|
entrypoint_name="${entrypoint_name}-${target}"
|
|
fi
|
|
|
|
repo_root="${GITHUB_WORKSPACE:-}"
|
|
if [[ -z "$repo_root" ]]; then
|
|
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
fi
|
|
|
|
if command -v python3 >/dev/null 2>&1; then
|
|
python_bin="python3"
|
|
else
|
|
python_bin="python"
|
|
fi
|
|
|
|
if ! command -v zstd >/dev/null 2>&1 && [[ -x "${repo_root}/.github/workflows/zstd" ]]; then
|
|
export PATH="${repo_root}/.github/workflows:${PATH}"
|
|
fi
|
|
|
|
mkdir -p "$archive_dir"
|
|
package_dir="${RUNNER_TEMP:-/tmp}/${archive_stem}-${target}"
|
|
gzip_archive_path="${archive_dir}/${archive_stem}-${target}.tar.gz"
|
|
zstd_archive_path="${archive_dir}/${archive_stem}-${target}.tar.zst"
|
|
rm -rf "$package_dir"
|
|
|
|
"$python_bin" "${repo_root}/scripts/build_codex_package.py" \
|
|
--target "$target" \
|
|
--variant "$variant" \
|
|
--entrypoint-bin "${entrypoint_dir%/}/${entrypoint_name}${exe_suffix}" \
|
|
--cargo-profile release \
|
|
--package-dir "$package_dir" \
|
|
--archive-output "$gzip_archive_path" \
|
|
--archive-output "$zstd_archive_path" \
|
|
--force
|