Repology metadata #6846
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Repology metadata | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| main: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Clone repository | |
| uses: actions/checkout@v5 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Clone termux-packages | |
| run: | | |
| mkdir -p /tmp/repos | |
| # We are doing a full clone because we are extracting the commit ids of | |
| # the last commit where the patch files and build.sh were changed | |
| git clone --filter=blob:none \ | |
| https://github.com/termux/termux-packages.git \ | |
| /tmp/repos/termux-packages | |
| cd /tmp/repos/termux-packages | |
| # Speed up git log by significant amount | |
| # See: https://stackoverflow.com/questions/35186829/how-to-improve-git-log-performance | |
| # | |
| # git gc further reduces the time to build the metadata on my 20-thread laptop from 1m42s to 0m12s | |
| # The other optimistions are taken from the above linked stackoverflow post | |
| # | |
| # Although the improvements are great on my powerful laptop, the CI only has 2 cores, so this just | |
| # slows it down as gc is a CPU intensive task. | |
| # git gc --aggressive | |
| git config core.commitGraph true | |
| git config gc.writeCommitGraph true | |
| git repack -Ad --max-pack-size=1g | |
| git commit-graph write --changed-paths --reachable | |
| - name: Generate packages.json | |
| run: | | |
| export TERMUX_SCRIPTDIR=/tmp/repos/termux-packages | |
| bash ./generate-repology-metadata.sh /tmp/repos/termux-packages > ./packages.json | |
| if ! jq . ./packages.json > /dev/null; then | |
| echo "Error: invalid packages.json" > /dev/stderr | |
| exit 1 | |
| fi | |
| if [ $(git diff ./packages.json | wc -l) -gt 0 ]; then | |
| git config --global user.name "Termux Github Actions" | |
| git config --global user.email "[email protected]" | |
| git add ./packages.json | |
| git commit -m "Generate new metadata for Repology" | |
| git push | |
| fi |