Files
runner-images/images/macos/provision/core/nvm.sh
T

30 lines
969 B
Bash
Raw Normal View History

#!/bin/bash -e -o pipefail
2020-09-10 14:34:08 +03:00
###########################################################################
# The script installs node version manager with node versions 10,12 and 14
2020-09-10 14:34:08 +03:00
#
###########################################################################
source ~/utils/utils.sh
[ -n "$API_PAT" ] && authString=(-H "Authorization: token ${API_PAT}")
VERSION=$(curl "${authString[@]}" -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | jq -r '.tag_name')
2020-10-01 11:31:02 +02:00
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$VERSION/install.sh | bash
2020-09-10 14:34:08 +03:00
if [ $? -eq 0 ]; then
. ~/.bashrc
nvm --version
2021-11-09 17:49:30 +03:00
nodeVersions=$(get_toolset_value '.node.nvm_versions[]')
for version in ${nodeVersions[@]}
do
2021-11-09 17:49:30 +03:00
nvm install v${version}
done
# set system node as default
nvm alias default system
2020-09-10 14:34:08 +03:00
else
2020-10-01 11:31:02 +02:00
echo error
2020-09-10 14:34:08 +03:00
fi
echo "Node version manager has been installed successfully"
invoke_tests "Node" "nvm"