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:
|
workflow_dispatch:
|
||||||
|
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '@hourly'
|
- cron: '0 */4 * * *'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
mirror-main:
|
mirror-main:
|
||||||
|
@ -15,14 +15,14 @@ jobs:
|
||||||
downstream: https://ayakael.net/api/packages/alpine/alpine/edge/main
|
downstream: https://ayakael.net/api/packages/alpine/alpine/edge/main
|
||||||
steps:
|
steps:
|
||||||
- name: Environment setup
|
- name: Environment setup
|
||||||
run: apk add grep coreutils gawk curl
|
run: apk add grep coreutils gawk curl wget
|
||||||
- name: Fetch info from upstream
|
- name: Fetch info from upstream
|
||||||
run: |
|
run: |
|
||||||
apk --allow-untrusted --update-cache --repositories-file /dev/null --repository $upstream update
|
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
|
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
|
- name: Fetch info from downstream
|
||||||
run: |
|
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
|
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
|
- name: Missing apks detection
|
||||||
run: |
|
run: |
|
||||||
|
@ -31,10 +31,22 @@ jobs:
|
||||||
cat missing
|
cat missing
|
||||||
- name: Send missing packages downstream
|
- name: Send missing packages downstream
|
||||||
run: |
|
run: |
|
||||||
|
wc -l missing | awk '{print $1}' > total
|
||||||
|
read total < total
|
||||||
|
count=1
|
||||||
while read pkgs; do
|
while read pkgs; do
|
||||||
echo "Sending $pkgs"
|
echo "[ $count / $total ] Sending $pkgs"
|
||||||
# if fails continue
|
# github actions doesn't do double pipe error suppression, use !
|
||||||
wget $upstream/x86_64/$pkgs.apk || continue
|
! wget -q $upstream/x86_64/$pkgs.apk
|
||||||
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file $pkgs.apk $downstream
|
# if it doesn't exist, it is because it failed to download.
|
||||||
rm $pkgs.apk
|
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
|
done < missing
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
schedule:
|
||||||
|
- cron: '0 */4 * * *'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
mirror-testing:
|
mirror-testing:
|
||||||
name: Mirror testing apks downstream
|
name: Mirror testing apks downstream
|
||||||
|
@ -12,14 +15,14 @@ jobs:
|
||||||
downstream: https://ayakael.net/api/packages/alpine/alpine/edge/testing
|
downstream: https://ayakael.net/api/packages/alpine/alpine/edge/testing
|
||||||
steps:
|
steps:
|
||||||
- name: Environment setup
|
- name: Environment setup
|
||||||
run: apk add grep coreutils gawk curl
|
run: apk add grep coreutils gawk curl wget
|
||||||
- name: Fetch info from upstream
|
- name: Fetch info from upstream
|
||||||
run: |
|
run: |
|
||||||
apk --allow-untrusted --update-cache --repositories-file /dev/null --repository $upstream update
|
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
|
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
|
- name: Fetch info from downstream
|
||||||
run: |
|
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
|
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
|
- name: Missing apks detection
|
||||||
run: |
|
run: |
|
||||||
|
@ -28,10 +31,22 @@ jobs:
|
||||||
cat missing
|
cat missing
|
||||||
- name: Send missing packages downstream
|
- name: Send missing packages downstream
|
||||||
run: |
|
run: |
|
||||||
|
wc -l missing | awk '{print $1}' > total
|
||||||
|
read total < total
|
||||||
|
count=1
|
||||||
while read pkgs; do
|
while read pkgs; do
|
||||||
echo "Sending $pkgs"
|
echo "[ $count / $total ] Sending $pkgs"
|
||||||
# if fails continue
|
# github actions doesn't do double pipe error suppression, use !
|
||||||
wget $upstream/x86_64/$pkgs.apk || continue
|
! wget -q $upstream/x86_64/$pkgs.apk
|
||||||
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file $pkgs.apk $downstream
|
# if it doesn't exist, it is because it failed to download.
|
||||||
rm $pkgs.apk
|
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
|
done < missing
|
||||||
|
|
Loading…
Reference in a new issue