26 lines
1.5 KiB
Bash
26 lines
1.5 KiB
Bash
#!/usr/bin/env bash
|
|
# Source this file in a Linux job after checking out the catalog.
|
|
set -euo pipefail
|
|
export npm_config_registry="${NPM_REGISTRY:-https://registry.npmmirror.com}"
|
|
export COREPACK_NPM_REGISTRY="$npm_config_registry"
|
|
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
|
if ! command -v node >/dev/null || ! node -e 'process.exit(Number(process.versions.node.split(".")[0]) >= 22 ? 0 : 1)'; then
|
|
case "$(uname -m)" in
|
|
x86_64) node_arch=x64; node_sha=d60acfe00a2932254bb0ad20e01b0d74397a0875595de719654b214f4b03f307 ;;
|
|
aarch64|arm64) node_arch=arm64; node_sha=fff4078c5def658577f92c88db7db3bc0072924bfb93fe52c1e744a54e94abb8 ;;
|
|
*) echo 'Unsupported Linux runner architecture' >&2; exit 1 ;;
|
|
esac
|
|
node_archive="node-v22.23.2-linux-${node_arch}.tar.xz"
|
|
node_cache="${RUNNER_TEMP:-/tmp}/trove-node-22.23.2-${node_arch}"
|
|
mkdir -p "$node_cache"
|
|
curl --fail --location --retry 3 --connect-timeout 15 --max-time 180 \
|
|
"${NODE_MIRROR:-https://npmmirror.com/mirrors/node}/v22.23.2/$node_archive" -o "$node_cache/$node_archive"
|
|
# Hashes are pinned from the official nodejs.org SHASUMS256.txt.
|
|
printf '%s %s\n' "$node_sha" "$node_cache/$node_archive" | sha256sum --check --status
|
|
tar -xJf "$node_cache/$node_archive" -C "$node_cache" --strip-components=1
|
|
export PATH="$node_cache/bin:$PATH"
|
|
fi
|
|
node --version
|
|
# The catalog only needs semver; avoid downloading pnpm/Corepack in each job.
|
|
npm install --ignore-scripts --no-audit --no-fund --package-lock=false
|