Use npm repo instead of apt on Yarn install

Co-authored-by: Lukas 'Eipi' Eipert <leipert@gitlab.com>
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
This commit is contained in:
Takuya Noguchi 2021-04-21 02:49:33 +00:00
parent 351ef2e34a
commit e29a606bbc
4 changed files with 10 additions and 11 deletions

View file

@ -3,15 +3,13 @@ set -xeuo pipefail
IFS=$'\n\t'
NODE_INSTALL_VERSION=${1:-14.16.0}
YARN_INSTALL_VERSION=${2:-1.21.1-1}
YARN_INSTALL_VERSION=${2:-1.22.10}
# Map MAJOR.MINOR.patch -> MAJOR.x
NODE_MAJOR=`echo $NODE_INSTALL_VERSION | sed -r -e "s/([0-9]+)\.[0-9]+.*/\1\.x/g"`
# add official debian repos for node and yarn
# add official debian repos for node
curl -sS -L https://deb.nodesource.com/setup_${NODE_MAJOR} | bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
apt-get update
@ -20,7 +18,8 @@ curl -s -O "https://deb.nodesource.com/node_$NODE_MAJOR/pool/main/n/nodejs/$NODE
dpkg -i "$NODE_FILE_NAME"
rm -f "$NODE_FILE_NAME"
apt-get install -y yarn=$YARN_INSTALL_VERSION
npm install --global yarn@${YARN_INSTALL_VERSION}
npm cache clean --force
apt-get autoremove -yq
apt-get clean -yqq