termux-packages/.github/workflows/repology_metadata.yml

59 lines
2.8 KiB
YAML
Raw Normal View History

2020-01-22 01:25:35 +01:00
name: Repology metadata
on:
schedule:
- cron: '0 */3 * * *'
workflow_dispatch:
2020-01-22 01:25:35 +01:00
jobs:
update:
runs-on: ubuntu-latest
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
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:
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}" \
"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
echo "Failed to delete entry for version 'current' !"
echo "response: $response"
2020-01-22 01:25:35 +01:00
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
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 !"
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