Update other workflows
This commit is contained in:
parent
8447a8ec15
commit
67b35940c6
2 changed files with 42 additions and 15 deletions
|
@ -2,7 +2,7 @@ on:
|
|||
workflow_dispatch:
|
||||
|
||||
schedule:
|
||||
- cron: '@hourly'
|
||||
- cron: '0 */4 * * *'
|
||||
|
||||
jobs:
|
||||
mirror-main:
|
||||
|
@ -15,14 +15,14 @@ jobs:
|
|||
downstream: https://ayakael.net/api/packages/alpine/alpine/edge/main
|
||||
steps:
|
||||
- name: Environment setup
|
||||
run: apk add grep coreutils gawk curl
|
||||
run: apk add grep coreutils gawk curl wget
|
||||
- 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 update
|
||||
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: |
|
||||
|
@ -31,10 +31,22 @@ jobs:
|
|||
cat missing
|
||||
- name: Send missing packages downstream
|
||||
run: |
|
||||
wc -l missing | awk '{print $1}' > total
|
||||
read total < total
|
||||
count=1
|
||||
while read pkgs; do
|
||||
echo "Sending $pkgs"
|
||||
# if fails continue
|
||||
wget $upstream/x86_64/$pkgs.apk || continue
|
||||
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file $pkgs.apk $downstream
|
||||
rm $pkgs.apk
|
||||
echo "[ $count / $total ] Sending $pkgs"
|
||||
# github actions doesn't do double pipe error suppression, use !
|
||||
! wget -q $upstream/x86_64/$pkgs.apk
|
||||
# if it doesn't exist, it is because it failed to download.
|
||||
if [ -f $pkgs.apk ]; then
|
||||
result=`curl -s --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file $pkgs.apk $downstream`
|
||||
if [ -n "$result" ]; then
|
||||
echo $result
|
||||
fi
|
||||
rm -f $pkgs.apk
|
||||
else
|
||||
echo "Error: Couldn't download $pkgs"
|
||||
fi
|
||||
count=$(( count + 1 ))
|
||||
done < missing
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
schedule:
|
||||
- cron: '0 */4 * * *'
|
||||
|
||||
jobs:
|
||||
mirror-testing:
|
||||
name: Mirror testing apks downstream
|
||||
|
@ -12,14 +15,14 @@ jobs:
|
|||
downstream: https://ayakael.net/api/packages/alpine/alpine/edge/testing
|
||||
steps:
|
||||
- name: Environment setup
|
||||
run: apk add grep coreutils gawk curl
|
||||
run: apk add grep coreutils gawk curl wget
|
||||
- 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 update
|
||||
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: |
|
||||
|
@ -28,10 +31,22 @@ jobs:
|
|||
cat missing
|
||||
- name: Send missing packages downstream
|
||||
run: |
|
||||
wc -l missing | awk '{print $1}' > total
|
||||
read total < total
|
||||
count=1
|
||||
while read pkgs; do
|
||||
echo "Sending $pkgs"
|
||||
# if fails continue
|
||||
wget $upstream/x86_64/$pkgs.apk || continue
|
||||
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file $pkgs.apk $downstream
|
||||
rm $pkgs.apk
|
||||
echo "[ $count / $total ] Sending $pkgs"
|
||||
# github actions doesn't do double pipe error suppression, use !
|
||||
! wget -q $upstream/x86_64/$pkgs.apk
|
||||
# if it doesn't exist, it is because it failed to download.
|
||||
if [ -f $pkgs.apk ]; then
|
||||
result=`curl -s --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file $pkgs.apk $downstream`
|
||||
if [ -n "$result" ]; then
|
||||
echo $result
|
||||
fi
|
||||
rm -f $pkgs.apk
|
||||
else
|
||||
echo "Error: Couldn't download $pkgs"
|
||||
fi
|
||||
count=$(( count + 1 ))
|
||||
done < missing
|
||||
|
|
Loading…
Reference in a new issue