From 06ffd18b532e25fcd63fadd96f1710c3156802e0 Mon Sep 17 00:00:00 2001 From: Idan Cohen Date: Wed, 2 Mar 2022 14:56:02 +0200 Subject: [PATCH] feat: :sparkles: Upload packages --- pip-install.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/pip-install.sh b/pip-install.sh index 1533042..a3463b2 100755 --- a/pip-install.sh +++ b/pip-install.sh @@ -6,7 +6,9 @@ print_help() { echo -e "$0 " echo -e echo -e "For UPLOAD" - echo -e "$0 " + echo -e "$0 " + echo -e "Like this:" + echo -e "/service/rest/v1/components?repository=" echo -e } @@ -15,15 +17,15 @@ download_package() { pip download $package } -# insert registry, repository and package to upload +# insert nexus_host, repository and package to upload upload_package() { - local registry=$1 + local nexus_host=$1 local repository=$2 local package=$3 - curl -X POST "$registry/service/rest/v1/components?repository=$repository" \ + curl -X POST "$nexus_host/service/rest/v1/components?repository=$repository" \ -H "accept: application/json" \ -H "Content-Type: multipart/form-data" \ - -F "pypi.asset=@$package" + -F "pypi.asset=@$package" -i } @@ -36,15 +38,20 @@ upload_packages() { } +remove_all_packages() { + rm *.whl +} + + main() { if [[ $# -eq 1 ]]; then download_package $1 elif [[ $# -eq 3 ]]; then - echo "hello" + upload_packages $@ + remove_all_packages else print_help fi } -# main $@ -upload_packages \ No newline at end of file +main $@ \ No newline at end of file