a6aa0c4ae8
- Updated Rust toolchain checks to use a prefix-aware grep pattern when validating installed components. - Simplified the Zig installer action to extract into ~/.local and add the archive directory directly to PATH. - Adjusted runner checks to parse sccache and gh version output via positional shell fields for stability.
40 lines
1.3 KiB
YAML
40 lines
1.3 KiB
YAML
name: "ensure zig"
|
|
description: Ensure a pinned Zig binary is on PATH.
|
|
|
|
inputs:
|
|
version:
|
|
required: true
|
|
description: Zig release version
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- shell: bash
|
|
env:
|
|
ZIG_VERSION: ${{ inputs.version }}
|
|
run: |
|
|
set -euo pipefail
|
|
if command -v zig >/dev/null 2>&1 && [ "$(zig version)" = "$ZIG_VERSION" ]; then
|
|
echo "Using baked zig $ZIG_VERSION"
|
|
exit 0
|
|
fi
|
|
|
|
case "$(uname -s)-$(uname -m)" in
|
|
Linux-x86_64) archive="zig-x86_64-linux-${ZIG_VERSION}" ;;
|
|
Darwin-arm64) archive="zig-aarch64-macos-${ZIG_VERSION}" ;;
|
|
Darwin-x86_64) archive="zig-x86_64-macos-${ZIG_VERSION}" ;;
|
|
*)
|
|
echo "Unsupported zig host: $(uname -s)-$(uname -m)" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
destdir="${HOME}/.local"
|
|
mkdir -p "$destdir"
|
|
rm -rf "${destdir:?}/${archive}"
|
|
curl -fsSL "https://ziglang.org/download/${ZIG_VERSION}/${archive}.tar.xz" -o "${destdir}/zig.tar.xz"
|
|
tar -xJf "${destdir}/zig.tar.xz" -C "$destdir"
|
|
rm -f "${destdir}/zig.tar.xz"
|
|
echo "${destdir}/${archive}" >> "$GITHUB_PATH"
|
|
echo "Installed zig $("${destdir}/${archive}/zig" version)"
|