File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -euo pipefail
4+
5+ VERSION=${1:? " Missing version number argument (arg 1)" }
6+ NEXUS_USER=${2:? " Missing Nexus username argument (arg 2)" }
7+
8+ read -r -s -p " Nexus Password: " NEXUS_PASSWORD
9+ echo " "
10+
11+ # https://stackoverflow.com/questions/4632028/how-to-create-a-temporary-directory
12+ # Find the directory name of the script
13+ DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
14+
15+ # the temp directory used, within $DIR
16+ WORK_DIR=$( mktemp -d -p " $DIR " )
17+
18+ # check if tmp dir was created
19+ if [[ ! " $WORK_DIR " || ! -d " $WORK_DIR " ]]; then
20+ echo " Could not create temp dir"
21+ exit 1
22+ fi
23+
24+ # deletes the temp directory
25+ function cleanup {
26+ rm -rf " $WORK_DIR "
27+ }
28+
29+ # register the cleanup function to be called on the EXIT signal
30+ trap cleanup EXIT
31+
32+ cd " $WORK_DIR " || exit
33+
34+ echo " Downloading nvm.sh @ $VERSION from github.com"
35+ curl --fail -L --progress-bar -o " nvm-$VERSION .sh" " https://raw.githubusercontent.com/nvm-sh/nvm/refs/tags/${VERSION} /nvm.sh"
36+
37+ echo " Uploading nvm-$VERSION .sh to Nexus"
38+ curl --fail -o /dev/null --progress-bar -u " $NEXUS_USER :$NEXUS_PASSWORD " \
39+ --upload-file " nvm-$VERSION .sh" \
40+ ' https://repo.stackable.tech/repository/packages/nvm/'
41+
42+ echo " Successfully uploaded new version $VERSION to Nexus"
43+ echo " https://repo.stackable.tech/service/rest/repository/browse/packages/nvm/"
You can’t perform that action at this time.
0 commit comments