Verified Commit 6b9c872a authored by noplanman's avatar noplanman
Browse files

Upload unstable binaries to a separate package

parent 4534ce1d
......@@ -39,7 +39,8 @@ deploy artifacts to bintray:
tags: [dind]
only: [tags]
script:
- md5sum borg-${VERSION}-*
- md5sum borg-${VERSION}-* | tee ci/md5sums
- sha256sum borg-${VERSION}-* | tee ci/sha256sums
- apk add curl jq
- ci/bintray.sh
dependencies:
......
......@@ -8,7 +8,14 @@
# BINTRAY_API_KEY=$2
# BINTRAY_REPO=$3
PKG_NAME=borg-binaries
PKG_NAME=stable
MATURITY=Stable
# Put unstable builds in an "unstable" package
if expr "${VERSION}" : ".*[a-z].*" >/dev/null; then
PKG_NAME=unstable
MATURITY=Development
fi
API=https://api.bintray.com
CURL="curl -u${BINTRAY_USER}:${BINTRAY_API_KEY} -H Content-Type:application/json -H Accept:application/json"
......@@ -17,7 +24,7 @@ GH_CURL="curl -H Content-Type:application/json -H Accept:application/json"
DATA="{
\"name\": \"${PKG_NAME}\",
\"desc\": \"BorgBackup binaries for various architectures\",
\"desc\": \"${MATURITY} BorgBackup binaries for various architectures\",
\"vcs_url\": \"${CI_PROJECT_URL}\",
\"licenses\": [\"WTFPL\"],
\"issue_tracker_url\": \"${CI_PROJECT_URL}/issues\",
......@@ -25,10 +32,11 @@ DATA="{
\"desc_url\": \"${CI_PROJECT_URL}\",
\"labels\": [\"borg\", \"borgbackup\", \"binaries\"],
\"public_download_numbers\": true,
\"public_stats\": true
\"public_stats\": true,
\"maturity\": \"${MATURITY}\"
}"
printf "%s" "Creating package ${PKG_NAME}..."
printf "%s" "Creating package '${PKG_NAME}...'"
PACKAGE=$(${CURL} -s -X POST -d "${DATA}" "${API}/packages/${BINTRAY_REPO}")
echo " ✅ Done!"
echo "${PACKAGE}"
......@@ -50,18 +58,15 @@ for BIN in $(ls borg-${VERSION}-*); do
if [ $STATUS_CODE -eq 201 ]; then
printf "%s" "📡 Publishing... "
PUBLISH=$(${CURL} -s -X POST -d "{ \"discard\": \"false\" }" \
PUBLISH=$(${CURL} -s -X POST -d "{ \"discard\": false }" \
"${API}/content/${BINTRAY_REPO}/${PKG_NAME}/${VERSION}/publish")
# Give the files some time to arrive...
sleep 8
# Give the file some time to arrive...
sleep 11
# Don't add unstable versions (alpha, beta) to direct download list.
if [[ ! "${VERSION}" =~ [[:alpha:]] ]]; then
printf "%s" "🎯 Adding to download list... "
${CURL} -s -X PUT -d "{ \"list_in_downloads\": true }" \
"${API}/file_metadata/${BINTRAY_REPO}/${UPSTREAM}" > /dev/null
fi
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}"
......@@ -85,9 +90,8 @@ GH_RELEASE_BODY=$(printf "%s" "${GH_RELEASE_INFO}" | jq '.body' | sed -e "s/^\"/
${CURL} -s -X PATCH -d "{ \"vcs_tag\": \"${VERSION}\", \"released\": \"${GH_RELEASE_DATE}\", \"desc\": \"${GH_RELEASE_URL}\" }" \
"${API}/packages/${BINTRAY_REPO}/${PKG_NAME}/versions/${VERSION}" > /dev/null
# Set version release notes including SHA256 sums for binaries.
SHA256SUMS="$(sha256sum borg-${VERSION}-*)"
${CURL} -s -X POST -d "{ \"bintray\": { \"syntax\": \"markdown\", \"content\": \"# Binaries for [BorgBackup ${VERSION}](${GH_RELEASE_URL})\n\n${GH_RELEASE_BODY}\n\n##SHA256 Sums for binaries\n\`\`\`\n${SHA256SUMS}\n\`\`\`\" } }" \
# Set version release notes including MD5 and SHA256 sums for binaries.
${CURL} -s -X POST -d "{ \"bintray\": { \"syntax\": \"markdown\", \"content\": \"# Binaries for [BorgBackup ${VERSION}](${GH_RELEASE_URL})\n\n${GH_RELEASE_BODY}\n\n##MD5 Sums for binaries\n\`\`\`\n$(cat md5sums)\n\`\`\`\\n##SHA256 Sums for binaries\n\`\`\`\n$(cat sha256sums)\n\`\`\`\" } }" \
"${API}/packages/${BINTRAY_REPO}/${PKG_NAME}/versions/${VERSION}/release_notes" > /dev/null
echo " ✅ 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