Skip to content

Commit 6a61990

Browse files
committed
add 18.20 node installation to buildLinux
1 parent 7a8137c commit 6a61990

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

shared-scripts.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
AMPLIFY_NODE_VERSION=18.20.4
4+
35
# set exit on error to true
46
set -e
57

@@ -131,6 +133,7 @@ function _setShell {
131133

132134
function _buildLinux {
133135
_setShell
136+
_setupNodeVersion $AMPLIFY_NODE_VERSION
134137
echo "Linux Build"
135138
yarn run production-build
136139
storeCacheForLinuxBuildJob
@@ -512,4 +515,25 @@ function _emitRegionalizedCanaryMetric {
512515
--value $CODEBUILD_BUILD_SUCCEEDING \
513516
--dimensions branch=release,region=$CLI_REGION \
514517
--region us-west-2
518+
}
519+
520+
function _setupNodeVersion {
521+
local version=$1 # Version number passed as an argument
522+
523+
echo "Installing NVM and setting Node.js version to $version"
524+
525+
# Install NVM
526+
curl -o - https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
527+
528+
# Load NVM
529+
export NVM_DIR="$HOME/.nvm"
530+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
531+
532+
# Install and use the specified Node.js version
533+
nvm install "$version"
534+
nvm use "$version"
535+
536+
# Verify the Node.js version in use
537+
echo "Node.js version in use:"
538+
node -v
515539
}

0 commit comments

Comments
 (0)