forked from streamlink/streamlink
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbintrayupdate.sh
More file actions
executable file
·21 lines (17 loc) · 882 Bytes
/
Copy pathbintrayupdate.sh
File metadata and controls
executable file
·21 lines (17 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash
set -e
# Update the Bintray release
old_date=$(date +"%Y.%m.%d" -d "30 days ago")
build_dir="$(pwd)/build"
api_base="https://api.bintray.com/packages/streamlink/streamlink-nightly/streamlink"
current_api_url="${api_base}/versions/$(date +'%Y.%m.%d')/release_notes"
files_api_url="${api_base}/files"
versions_api_url="${api_base}/versions"
curl -u "${BINTRAY_USER}:${BINTRAY_KEY}" -H "Content-Type: application/json" -d @"${build_dir}/bintray-changelog.json" "${current_api_url}"
echo "Deleting versions older than ${old_date}..."
versions=$(curl -s -u "${BINTRAY_USER}:${BINTRAY_KEY}" "${files_api_url}" | jq -r '.[].version')
for version in $versions; do
if [[ "$version" < "$old_date" ]]; then
curl -s -u "${BINTRAY_USER}:${BINTRAY_KEY}" -X DELETE "${versions_api_url}/${version}" -o /dev/null && echo "Deleted version: ${version}"
fi
done