bintray.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/bash
  2. # bintray_createPackage [REPO] [PACKAGE] [USER] [PASSWORD] [GIT REPO] [LICENSE]
  3. function bintray_createPackage {
  4. repo="$1"
  5. package="$2"
  6. user="$3"
  7. password="$4"
  8. srcrepo="$5"
  9. license="$6"
  10. repoUrl="https://api.bintray.com/packages/$repo"
  11. if [ "`curl -u$user:$password -H Content-Type:application/json -H Accept:application/json \
  12. --write-out %{http_code} --silent --output /dev/null -X GET \"$repoUrl/$package\"`" != "200" ];
  13. then
  14. if [ "$srcrepo" != "" -a "$license" != "" ];
  15. then
  16. echo "Package does not exist... create."
  17. data="{
  18. \"name\": \"${package}\",
  19. \"labels\": [],
  20. \"licenses\": [\"${license}\"],
  21. \"vcs_url\": \"${srcrepo}\"
  22. }"
  23. curl -u$user:$password -H "Content-Type:application/json" -H "Accept:application/json" -X POST \
  24. -d "${data}" "$repoUrl"
  25. else
  26. echo "Package does not exist... you need to specify a repo and license for it to be created."
  27. fi
  28. else
  29. echo "The package already exists. Skip."
  30. fi
  31. }
  32. # minio_uploadFile <LOCAL_FILEPATH> <REMOTE_FILEPATH> <MINIO_URL> <MINIO_ACCESS_KEY> <MINIO_SECRET_KEY>
  33. #
  34. # Upload the specified file to the specified MinIO instance.
  35. function minio_uploadFile {
  36. file="$1"
  37. dest="$2"
  38. url="$3"
  39. access="$4"
  40. secret="$5"
  41. echo "Install MinIO client"
  42. wget --quiet https://dl.min.io/client/mc/release/linux-amd64/mc
  43. chmod +x ./mc
  44. echo "Add an alias for the MinIO instance to the MinIO configuration file"
  45. ./mc alias set objects "$url" "$access" "$secret"
  46. echo "Upload $file to $url/$dest"
  47. ./mc cp "$file" "objects/$dest"
  48. }