Make bintray.sh output a bit prettier and also add downloads the the download list for easy access.

parent 973ffd40
......@@ -26,27 +26,39 @@ DATA="{
\"public_stats\": true
}"
echo "Creating package ${PKG_NAME}..."
${CURL} -X POST -d "${DATA}" "${API}/packages/${BINTRAY_REPO}"
printf "%s" "Creating package ${PKG_NAME}..."
PACKAGE=$(${CURL} -s -X POST -d "${DATA}" "${API}/packages/${BINTRAY_REPO}")
echo " 👍 Done!"
echo "${PACKAGE}"
for BIN in $(ls borg-${VERSION}-*); do
LOG=$(mktemp)
ARCH=$(echo "${BIN}" | cut -d/ -f4 | cut -d- -f3)
UPSTREAM="borg-${VERSION}-${ARCH}"
STATUS_CODE=$(
${CURL} --write-out %{http_code} --silent --output "${LOG}" \
${CURL} -s --write-out %{http_code} --output "${LOG}" \
-T "${BIN}" -H X-Bintray-Package:"${PKG_NAME}" -H X-Bintray-Version:"${VERSION}" \
"${API}/content/${BINTRAY_REPO}/${UPSTREAM}"
)
if [ $STATUS_CODE -eq 201 ]; then
echo "Publishing ${UPSTREAM}..."
echo $(
${CURL} -X POST -d "{ \"discard\": \"false\" }" \
${API}/content/${BINTRAY_REPO}/${PKG_NAME}/${VERSION}/publish
)
printf "%s" "Publishing ${UPSTREAM}..."
PUBLISH=$(${CURL} -s -X POST -d "{ \"discard\": \"false\" }" \
"${API}/content/${BINTRAY_REPO}/${PKG_NAME}/${VERSION}/publish")
# Give the file some time to arrive...
sleep 5
printf "%s" "Adding to download list..."
${CURL} -s -X PUT -d "{ \"list_in_downloads\": \"true\" }" \
"${API}/file_metadata/${BINTRAY_REPO}/${UPSTREAM}" > /dev/null
echo " 👍 Done!"
echo "${PUBLISH}"
else
echo "Cannot publish ${UPSTREAM}!" && cat ${LOG} && exit 1
echo "😖 Cannot publish ${UPSTREAM}!"
echo "$(cat "${LOG}")"
exit 1
fi
rm "${LOG}"
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment