download #72818
This file contains 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: "download" | |
on: | |
workflow_dispatch: | |
push: | |
schedule: | |
- cron: "*/5 * * * *" | |
concurrency: | |
group: download | |
cancel-in-progress: false | |
env: | |
mirror: http://uvermont.mm.fcix.net/manjaro | |
upstream_mirror: https://geo.mirror.pkgbuild.com | |
upstream_mirror_arm: https://ca.us.mirror.archlinuxarm.org | |
jobs: | |
state: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- id: state | |
run: | | |
source <(curl -s ${{ env.mirror }}/state) | |
echo "state=$state" >>$GITHUB_OUTPUT | |
- id: state_upstream | |
run: | | |
source <(curl -s ${{ env.mirror_upstream }}/lastupdate) | |
echo "state=$state" >>$GITHUB_OUTPUT | |
- id: state_upstream_arm | |
run: | | |
source <(curl -s ${{ env.mirror_upstream }}/aarch64/sync) | |
echo "state=$state" >>$GITHUB_OUTPUT | |
- id: store | |
uses: boredland/action-commit-store@main | |
with: | |
storage-commit-sha: b18cb0794aefbe597c96eaaf593e170436b88f90 | |
key: state-hash-v0 | |
value: ${{ steps.state.outputs.state }}-${{ steps.state_upstream.outputs.state }}-${{ steps.state_upstream_arm.outputs.state }} | |
token: ${{ github.token }} | |
outputs: | |
updated: ${{ steps.store.outputs.updated }} | |
version: ${{ steps.store.outputs.value }} | |
download-db: | |
runs-on: ubuntu-latest | |
needs: [state] | |
permissions: | |
contents: write | |
if: ${{ needs.state.outputs.updated == 'true' }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
fetch-depth: 1 | |
- name: download | |
run: | | |
[ -d repo ] && find ./repo/ -type f -name '*.desc' -delete | |
for db in core extra multilib; do | |
for arch in x86_64 aarch64; do | |
for branch in stable testing unstable upstream_stable; do | |
if [ "$arch" == "aarch64" ]; then | |
down_branch=arm-${branch} | |
else | |
unset down_branch | |
fi | |
url=${mirror}/${down_branch:-${branch}}/${db}/${arch}/${db}.db.tar.gz | |
if [ "$branch" == "upstream_stable" ]; then | |
url=${upstream_mirror}/${db}/os/${arch}/${db}.db.tar.gz | |
if [ "$arch" == "aarch64" ]; then | |
url=${upstream_mirror_arm}/${arch}/${db}/${db}.db.tar.gz | |
fi | |
fi | |
echo downloading $url | |
curl -s $url | tar --warning=none -xz --transform="s,/desc,.desc," --one-top-level=./repo/${branch}/${db}/${arch}/ & | |
done | |
done | |
done | |
wait | |
- name: transform | |
run: | | |
git add . | |
git status --porcelain --no-renames | grep "^[A|M].*\.desc" | cut -d ' ' -f 3 | parallel python desc.py | |
- name: prune | |
run: | | |
git add . | |
git status --porcelain --no-renames | grep "^D.*\.desc" | cut -d ' ' -f 3 | parallel rm -f {\.}.json | |
- name: update db | |
run: | | |
python db.py | |
- name: persist | |
run: | | |
git config user.name repo-add-bot | |
git config user.email [email protected] | |
git add . | |
if [[ `git status --porcelain` ]]; then | |
git status --porcelain | |
git commit -m "update database" | |
git push | |
fi | |
- name: warm up search | |
run: | | |
for repo in core extra multilib; do | |
for arch in x86_64 aarch64; do | |
for branch in stable testing unstable upstream_stable; do | |
url="https://search.manjaro-sway.download/update?branch=${branch}&arch=${arch}&repo=${repo}" | |
echo warming up $url | |
curl -s $url | |
done | |
done | |
done | |
wait | |