From 767400a028923a0dcb153ebbae51b5c4f6749acd Mon Sep 17 00:00:00 2001 From: John Doe Date: Thu, 28 Oct 2021 19:34:23 +0800 Subject: [PATCH] Build: make sure cache was successfully saved --- .github/workflows/lo-test.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lo-test.yml b/.github/workflows/lo-test.yml index 2606c32..7abf433 100644 --- a/.github/workflows/lo-test.yml +++ b/.github/workflows/lo-test.yml @@ -153,11 +153,6 @@ jobs: export AUTH="Authorization: token ${{ secrets.SEC_TOKEN }}" export cache_path='github.com/repos/klever1988/sshactions/releases' export cache_repo_id='39020554' - ret=$(curl -sH "$AUTH" "https://api.$cache_path/tags/cache") - echo $ret | jq -r '.assets[] | select(.name | contains ("'$DEVICE'.img")).id' | \ - xargs -n1 -i curl -X DELETE -H "$AUTH" "https://api.$cache_path/assets/{}" - echo $ret | jq -r '.assets[] | select(.name == "ib-'$DEVICE'.tar.xz").id' | \ - xargs -n1 -i curl -X DELETE -H "$AUTH" "https://api.$cache_path/assets/{}" #zstdmt -c --adapt --long lede.img | parallel --wc --block 1.99G --pipe \ #'curl -s --data-binary @- -H "$AUTH" -H "Content-Type: application/octet-stream" https://uploads.$cache_path/$cache_repo_id/assets?name=lede.'$DEVICE'.img.zst.0{#} > /dev/null' zstdmt -c --long lede.img | split --numeric=1 -b 2000m - lede.$DEVICE.img.zst. @@ -165,7 +160,18 @@ jobs: #do # while true; do curl --data-binary @$f -H "$AUTH" -H 'Content-Type: application/octet-stream' "https://uploads.$cache_path/$cache_repo_id/assets?name=$f" && break || true; done #done + while true; do + ret=$(curl -sH "$AUTH" "https://api.$cache_path/tags/cache") + echo $ret | jq -r '.assets[] | select(.name | contains ("'$DEVICE'.img")).id' | \ + xargs -n1 -i curl -X DELETE -H "$AUTH" "https://api.$cache_path/assets/{}" + echo $ret | jq -r '.assets[] | select(.name == "ib-'$DEVICE'.tar.xz").id' | \ + xargs -n1 -i curl -X DELETE -H "$AUTH" "https://api.$cache_path/assets/{}" ls *img.zst* ib-$DEVICE.tar.xz | parallel --wc 'while true; do curl -T {} -H "$AUTH" -H "Content-Type: application/octet-stream" "https://uploads.$cache_path/$cache_repo_id/assets?name={}" && break || true; done' + set +e + for i in {1..20}; do curl -sL --fail https://github.com/klever1988/sshactions/releases/download/cache/lede.$DEVICE.img.zst.0$i || break; done | zstdmt -d -o /dev/null + set -e + if [ $? -eq 0 ]; then break; fi + done - name: Send tg notification if: env.TG