ci: enforce Node 20+ for wrangler deploy

This commit is contained in:
every.channel 2026-02-16 01:32:28 -05:00
parent 562073294d
commit 2d8c32741b
No known key found for this signature in database

View file

@ -48,10 +48,31 @@ jobs:
| tar -xz -C "$HOME/.local/bin" --strip-components=1 age/age age/age-keygen | tar -xz -C "$HOME/.local/bin" --strip-components=1 age/age age/age-keygen
fi fi
if ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then required_node_major=20
echo "error: node and npm are required on this runner" node_major=0
exit 2 if command -v node >/dev/null 2>&1; then
node_major="$(node -p 'parseInt(process.versions.node.split(\".\")[0], 10)' || echo 0)"
fi fi
if [[ "${node_major}" -lt "${required_node_major}" ]]; then
node_version="22.16.0"
arch="$(uname -m)"
case "${arch}" in
x86_64|amd64) node_arch="x64" ;;
aarch64|arm64) node_arch="arm64" ;;
*)
echo "error: unsupported runner arch for node prebuilt binary: ${arch}"
exit 2
;;
esac
node_dist="node-v${node_version}-linux-${node_arch}"
curl -fsSL "https://nodejs.org/dist/v${node_version}/${node_dist}.tar.xz" | tar -xJ -C "$HOME/.local"
ln -sf "$HOME/.local/${node_dist}/bin/node" "$HOME/.local/bin/node"
ln -sf "$HOME/.local/${node_dist}/bin/npm" "$HOME/.local/bin/npm"
ln -sf "$HOME/.local/${node_dist}/bin/npx" "$HOME/.local/bin/npx"
ln -sf "$HOME/.local/${node_dist}/bin/corepack" "$HOME/.local/bin/corepack" || true
fi
node --version
npm --version
- name: Configure CI Age identity - name: Configure CI Age identity
env: env: