From 07111b3252abf899d3c2943a143d1bc8b4be7dbd Mon Sep 17 00:00:00 2001 From: Christian Beer Date: Mon, 26 Nov 2018 21:07:11 +0100 Subject: [PATCH] Travis Bintray: add attributes to versions for better cleanup Attributes can be used to easily delete old versions. A script can check if a PR is closed and delete all versions for this PR on bintray. Or it could delete all versions older than a threshold. Attribtes only need to be added once. Currently this is done in the Travis build because this is running for every PR. --- deploy/deploy_to_bintray.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/deploy/deploy_to_bintray.sh b/deploy/deploy_to_bintray.sh index 7784e1d4a6..343e562f76 100755 --- a/deploy/deploy_to_bintray.sh +++ b/deploy/deploy_to_bintray.sh @@ -111,6 +111,15 @@ data="{ set +x ${CURL} -H Content-Type:application/json -X POST -d "${data}" "${API}/packages/${BINTRAY_REPO_OWNER}/${BINTRAY_REPO}/${PKG_NAME}/versions" +echo "Adding attributes to version ${VERSION}" +# this can be used to cleanup old versions +pr="${TRAVIS_PULL_REQUEST:-0}" +created=$(date -Is) +data="[{\"name\": \"PR\", \"values\": [\"${pr}\"], \"type\": \"string\"}, + {\"name\": \"create_time\", \"values\": [\"${created}\"], \"type\": \"date\"}]" +echo $data +${CURL} -H Content-Type:application/json -X POST -d "${data}" "${API}/packages/${BINTRAY_REPO_OWNER}/${BINTRAY_REPO}/${PKG_NAME}/versions/${VERSION}/attributes" + echo "Uploading and publishing ${SOURCE_DIR}/${BOINC_TYPE}.7z..." if [ -f "${SOURCE_DIR}/${BOINC_TYPE}.7z" ]; then set +x