feat: Upload packages

This commit is contained in:
2022-03-02 14:56:02 +02:00
parent 06caa42ed4
commit 06ffd18b53

View File

@@ -6,7 +6,9 @@ print_help() {
echo -e "$0 <package>" echo -e "$0 <package>"
echo -e echo -e
echo -e "For UPLOAD" echo -e "For UPLOAD"
echo -e "$0 <registry> <repository> <package>" echo -e "$0 <nexus_host> <repository> <package>"
echo -e "Like this:"
echo -e "<nexus_host>/service/rest/v1/components?repository=<repository>"
echo -e echo -e
} }
@@ -15,15 +17,15 @@ download_package() {
pip download $package pip download $package
} }
# insert registry, repository and package to upload # insert nexus_host, repository and package to upload
upload_package() { upload_package() {
local registry=$1 local nexus_host=$1
local repository=$2 local repository=$2
local package=$3 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 "accept: application/json" \
-H "Content-Type: multipart/form-data" \ -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() { main() {
if [[ $# -eq 1 ]]; then if [[ $# -eq 1 ]]; then
download_package $1 download_package $1
elif [[ $# -eq 3 ]]; then elif [[ $# -eq 3 ]]; then
echo "hello" upload_packages $@
remove_all_packages
else else
print_help print_help
fi fi
} }
# main $@ main $@
upload_packages