2024-10-16 02:37:57 +00:00
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
schedule:
|
|
|
|
- cron: '@hourly'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
mirror-main:
|
|
|
|
name: Mirror main apks downstream
|
|
|
|
runs-on: x86_64
|
|
|
|
container:
|
|
|
|
image: alpine:latest
|
|
|
|
env:
|
|
|
|
upstream: https://dl-cdn.alpinelinux.org/alpine/edge/main
|
|
|
|
downstream: https://ayakael.net/api/packages/alpine-archive/alpine/edge/main
|
|
|
|
steps:
|
|
|
|
- name: Environment setup
|
|
|
|
run: apk add grep coreutils gawk
|
|
|
|
- name: Fetch info from upstream
|
|
|
|
run: |
|
2024-10-16 02:41:42 +00:00
|
|
|
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
|
2024-10-16 02:37:57 +00:00
|
|
|
- name: Fetch info from downstream
|
|
|
|
run: |
|
2024-10-16 02:42:07 +00:00
|
|
|
apk --allow-untrusted --update-cache --repositories-file /dev/null --repository $downstream update || true
|
2024-10-16 02:41:42 +00:00
|
|
|
apk --allow-untrusted --update-cache --repositories-file /dev/null --repository $downstream list | grep -v installed | awk '{print $1, $2}' | sort > downstream
|
2024-10-16 02:37:57 +00:00
|
|
|
- name: Missing apks detection
|
|
|
|
run: |
|
|
|
|
comm -23 a b | 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
|