bintray.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/bash
  2. # Prerequistes
  3. # Environment variables:
  4. # BINTRAY_API_KEY - Working API key
  5. # BINTRAY_API_USER - Bintray username.
  6. # Run this from the repository root (required to get slic3r version)
  7. source $(dirname $0)/common/util.sh
  8. SLIC3R_VERSION=$(grep "VERSION" xs/src/libslic3r/libslic3r.h | awk -F\" '{print $2}')
  9. get_commit
  10. set_build_id
  11. set_branch
  12. set_pr_id
  13. if [ "$current_branch" == "master" ] && [ -z ${PR_ID} ]; then
  14. # If building master, goes in slic3r_dev or slic3r, depending on whether or not this is a tagged build
  15. if [ -z ${TAGGED+x} ]; then
  16. SLIC3R_PKG=slic3r_dev
  17. else
  18. SLIC3R_PKG=slic3r
  19. fi
  20. version=$SLIC3R_BUILD_ID
  21. else
  22. # If building a branch, put the package somewhere else.
  23. echo "Delploying pull request $PR_ID"
  24. SLIC3R_PKG=Slic3r_Branches
  25. version=${SLIC3R_BUILD_ID}-PR${PR_ID}
  26. fi
  27. file=$1
  28. echo "Deploying $file to $version on Bintray repo $SLIC3R_PKG..."
  29. API=${BINTRAY_API_KEY}
  30. USER=${BINTRAY_API_USER}
  31. echo "Creating version: $version"
  32. curl -s -X POST -d "{ \"name\": \"$version\", \"released\": \"ISO8601 $(date +%Y-%m-%d'T'%H:%M:%S)\", \"desc\": \"This version...\", \"github_release_notes_file\": \"RELEASE.txt\", \"github_use_tag_release_notes\": true, \"vcs_tag\": \"$version\" }" -u${USER}:${API} https://api.bintray.com/content/lordofhyphens/Slic3r/${SLIC3R_PKG}/versions
  33. echo "Publishing ${file} to ${version}..."
  34. curl -s -H "X-Bintray-Package: $SLIC3R_PKG" -H "X-Bintray-Version: $version" -H 'X-Bintray-Publish: 1' -H 'X-Bintray-Override: 1' -T $file -u${USER}:${API} https://api.bintray.com/content/lordofhyphens/Slic3r/$(basename $1)
  35. #curl -X POST -u${USER}:${API} https://api.bintray.com/content/lordofhyphens/Slic3r/${SLIC3R_PKG}/$version/publish
  36. # Wait 5s for the server to catch up
  37. #sleep 5
  38. #curl -H 'Content-Type: application/json' -X PUT -d "{ \"list_in_downloads\":true }" -u${USER}:${API} https://api.bintray.com/file_metadata/lordofhyphens/Slic3r/$(basename $1)
  39. exit 0