Browse Source

CI: delete & create version instead of updating file for repology metadata

Bintray allows version modification only during 365-day period.
master
Leonid Plyushch 5 years ago
parent
commit
e34376adb5
No known key found for this signature in database GPG Key ID: 45F2964132545795
  1. 12
      .github/workflows/repology_metadata.yml

12
.github/workflows/repology_metadata.yml

@ -31,11 +31,19 @@ jobs:
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
run: |
response=$(curl --silent --user "${BINTRAY_USERNAME}:${BINTRAY_API_KEY}" --request DELETE --write-out "|%{http_code}" \
"https://api.bintray.com/content/termux/metadata/repology/packages.json")
"https://api.bintray.com/packages/termux/metadata/repology/versions/current")
if [[ $(echo "$response" | cut -d'|' -f2) != "200" ]] && [[ $(echo "$response" | cut -d'|' -f2) != "404" ]]; then
echo "Old medatata deletion failed !"
echo "Failed to delete entry for version 'current' !"
echo "response: $response"
fi
response=$(curl --silent --user "${BINTRAY_USERNAME}:${BINTRAY_API_KEY}" --request POST --write-out "|%{http_code}" \
--header "Content-Type: application/json" --data '{"name":"current"}' \
"https://api.bintray.com/packages/termux/metadata/repology/versions")
if [[ $(echo "$response" | cut -d'|' -f2) != "201" ]] && [[ $(echo "$response" | cut -d'|' -f2) != "409" ]]; then
echo "Failed to create entry for version 'current' !"
echo "response: $response"
exit 1
fi
response=$(curl --silent --user "${BINTRAY_USERNAME}:${BINTRAY_API_KEY}" --request PUT \
--header "X-Bintray-Package: repology" --header "X-Bintray-Version: current" \
--header "X-Bintray-Publish: 1" --upload-file ./generated/packages.json --write-out "|%{http_code}" \

Loading…
Cancel
Save