Files
action-versions/script/internal/check-node.sh

18 lines
467 B
Bash
Raw Permalink Normal View History

2023-09-18 01:13:38 +00:00
#!/bin/bash
if [ -z "$(which node || exit 0)" ]; then
echo "Unable to find 'node' in the PATH"
exit 1
fi
node_version=$(node --version | grep --only-matching --extended-regexp 'v[0-9]+' | tr -d 'v')
if [ -z "$node_version" ]; then
2023-09-22 21:37:36 +00:00
echo "Unable to determine node version. Expected output of 'node --version' to contain a version, for example 'v18.18.0'"
2023-09-18 01:13:38 +00:00
exit 1
fi
2023-09-22 21:37:36 +00:00
if [ $node_version -lt 18 ]; then
echo "Node 18 or higher must be in the PATH"
2023-09-18 01:13:38 +00:00
exit 1
fi