Add community sync
This commit is contained in:
parent
c5a4eb3128
commit
418ef820ce
1 changed files with 36 additions and 0 deletions
36
.forgejo/workflows/sync-community.yml
Normal file
36
.forgejo/workflows/sync-community.yml
Normal file
|
@ -0,0 +1,36 @@
|
|||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
mirror-community:
|
||||
name: Mirror community apks downstream
|
||||
runs-on: x86_64
|
||||
container:
|
||||
image: alpine:latest
|
||||
env:
|
||||
upstream: https://dl-cdn.alpinelinux.org/alpine/edge/community
|
||||
downstream: https://ayakael.net/api/packages/alpine-archive/alpine/edge/community
|
||||
steps:
|
||||
- name: Environment setup
|
||||
run: apk add grep coreutils gawk curl
|
||||
- name: Fetch info from upstream
|
||||
run: |
|
||||
apk --allow-untrusted --update-cache --repositories-file /dev/null --repository $upstream update
|
||||
apk --allow-untrusted --update-cache --repositories-file /dev/null --repository $upstream list | grep -v installed | awk '{print $1, $2}' | sort > upstream
|
||||
- name: Fetch info from downstream
|
||||
run: |
|
||||
apk --allow-untrusted --update-cache --repositories-file /dev/null --repository $downstream update || true
|
||||
apk --allow-untrusted --update-cache --repositories-file /dev/null --repository $downstream list | grep -v installed | awk '{print $1, $2}' | sort > downstream
|
||||
- name: Missing apks detection
|
||||
run: |
|
||||
comm -23 upstream downstream | awk '{print $1}' > missing
|
||||
echo "Missing apks:"
|
||||
cat missing
|
||||
- name: Send missing packages downstream
|
||||
run: |
|
||||
while read pkgs; do
|
||||
echo "Sending $pkgs"
|
||||
wget $upstream/x86_64/$pkgs.apk
|
||||
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file $pkgs.apk $downstream
|
||||
rm $pkgs.apk
|
||||
done < missing
|
Loading…
Reference in a new issue