xpeditis2.0/scripts/ci/activate-node.sh
David e055af9afe
Some checks failed
Dev CI / Backend — Lint (push) Failing after 1m5s
Dev CI / Backend — Unit Tests (push) Has been skipped
Dev CI / Security gate (push) Failing after 1m20s
Dev CI / Frontend — Lint & Type-check (push) Successful in 1m46s
Dev CI / Frontend — Unit Tests (push) Successful in 1m21s
Dev CI / Notify Failure (push) Has been skipped
fix ci
2026-09-23 22:46:50 +02:00

24 lines
929 B
Bash

#!/usr/bin/env bash
set -euo pipefail
case "$(uname -m)" in
aarch64|arm64) arch=arm64 ;;
x86_64|amd64) arch=x64 ;;
*) echo 'Unsupported Node architecture' >&2; exit 1 ;;
esac
cache="${RUNNER_TOOL_CACHE:-${AGENT_TOOLSDIRECTORY:-/opt/hostedtoolcache}}"
# Select the newest installed Node 22 for this architecture, independent of the
# container's preinstalled Node 18 and setup-node's misleading version output.
node_bin=$(printf '%s\n' "$cache"/node/22.*/"$arch"/bin | sort -Vr | head -n 1)
if [[ ! -x "$node_bin/node" ]]; then
echo "Node 22 is missing from the tool cache: $cache/node (architecture $arch)" >&2
exit 1
fi
export PATH="$node_bin:$PATH"
hash -r
node -e 'if (process.versions.node.split(".")[0] !== "22") process.exit(1)'
printf '%s\n' "$node_bin" >> "${GITHUB_PATH:?}"
printf 'PATH=%s\n' "$PATH" >> "${GITHUB_ENV:?}"
printf 'Active Node executable: %s\n' "$(command -v node)"
node --version
npm --version