Build: make sure cache was successfully saved

This commit is contained in:
John Doe
2021-10-28 19:34:23 +08:00
parent 0a5c182473
commit 767400a028

View File

@@ -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