2020-01-22 01:25:35 +01:00
|
|
|
name: Repology metadata
|
|
|
|
|
|
|
|
on:
|
|
|
|
schedule:
|
2020-01-22 22:29:07 +01:00
|
|
|
- cron: '0 */3 * * *'
|
2020-01-22 01:25:35 +01:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
update:
|
2020-07-01 13:48:24 +02:00
|
|
|
runs-on: ubuntu-20.04
|
2020-01-22 01:25:35 +01:00
|
|
|
steps:
|
|
|
|
- name: Clone repository
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Clone supplementary package repositories
|
|
|
|
run: |
|
|
|
|
mkdir -p /tmp/repos
|
|
|
|
git clone --depth=1 https://github.com/termux/game-packages /tmp/repos/games
|
|
|
|
git clone --depth=1 https://github.com/termux/science-packages /tmp/repos/science
|
|
|
|
git clone --depth=1 https://github.com/termux/termux-root-packages /tmp/repos/root
|
|
|
|
git clone --depth=1 https://github.com/termux/unstable-packages /tmp/repos/unstable
|
|
|
|
git clone --depth=1 https://github.com/termux/x11-packages /tmp/repos/x11
|
|
|
|
- name: Process all Termux packages
|
|
|
|
run: |
|
|
|
|
mkdir -p generated
|
2020-05-11 15:49:36 +02:00
|
|
|
bash ./scripts/repology/generate-repology-metadata.sh ./packages/* /tmp/repos/*/packages/* > ./generated/packages.json
|
2020-01-22 01:25:35 +01:00
|
|
|
- name: Upload metadata to bintray.com
|
|
|
|
env:
|
2020-01-22 21:41:34 +01:00
|
|
|
BINTRAY_USERNAME: xeffyr
|
2020-01-22 01:25:35 +01:00
|
|
|
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
|
|
|
|
run: |
|
|
|
|
response=$(curl --silent --user "${BINTRAY_USERNAME}:${BINTRAY_API_KEY}" --request DELETE --write-out "|%{http_code}" \
|
2020-05-11 21:18:47 +02:00
|
|
|
"https://api.bintray.com/packages/termux/metadata/repology/versions/current")
|
2020-01-22 01:25:35 +01:00
|
|
|
if [[ $(echo "$response" | cut -d'|' -f2) != "200" ]] && [[ $(echo "$response" | cut -d'|' -f2) != "404" ]]; then
|
2020-05-11 21:18:47 +02:00
|
|
|
echo "Failed to delete entry for version 'current' !"
|
2020-05-11 21:04:34 +02:00
|
|
|
echo "response: $response"
|
2020-01-22 01:25:35 +01:00
|
|
|
fi
|
2020-05-11 21:18:47 +02:00
|
|
|
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
|
2020-01-22 01:25:35 +01:00
|
|
|
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}" \
|
|
|
|
"https://api.bintray.com/content/termux/metadata/repology/packages.json")
|
|
|
|
if [[ $(echo "$response" | cut -d'|' -f2) != "201" ]] && [[ $(echo "$response" | cut -d'|' -f2) != "409" ]]; then
|
|
|
|
echo "New metadata uploading failed !"
|
2020-05-11 21:04:34 +02:00
|
|
|
echo "response: $response"
|
2020-01-22 01:25:35 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
- name: Store packages.json as artifact
|
|
|
|
uses: actions/upload-artifact@v1
|
|
|
|
with:
|
|
|
|
name: repology-metadata
|
|
|
|
path: ./generated/packages.json
|