build-cache: make public

This commit is contained in:
John Doe
2021-03-01 15:12:03 +08:00
parent a0a480edf7
commit fe1730ae00

View File

@@ -34,15 +34,15 @@ jobs:
- name: Checkout - name: Checkout
run: | run: |
sudo curl https://raw.githubusercontent.com/klever1988/nanopi-openwrt/zstd-bin/zstd | sudo tee /usr/bin/zstd > /dev/null sudo curl https://raw.githubusercontent.com/klever1988/nanopi-openwrt/zstd-bin/zstd | sudo tee /usr/bin/zstd > /dev/null
for i in {0..5} for i in {1..6}
do do
curl -s -L --fail https://github.com/${{ github.repository }}/releases/download/cache/lede.${{ github.event.client_payload.device }}.img.zst.0$i || break curl -s -L --fail https://github.com/klever1988/sshactions/releases/download/cache/lede.${{ github.event.client_payload.device }}.img.zst.0$i || break
done | zstdmt -d -o lede.img || (truncate -s 40g lede.img && mkfs.xfs lede.img) done | zstdmt -d -o lede.img || (truncate -s 40g lede.img && mkfs.xfs lede.img)
LOOP_DEVICE=$(losetup -f) && echo $LOOP_DEVICE > LOOP_DEVICE LOOP_DEVICE=$(losetup -f) && echo $LOOP_DEVICE > LOOP_DEVICE
sudo losetup -P --direct-io $LOOP_DEVICE lede.img sudo losetup -P --direct-io $LOOP_DEVICE lede.img
mkdir lede && sudo mount $LOOP_DEVICE lede && sudo chown -R $USER:$USER lede mkdir lede && sudo mount $LOOP_DEVICE lede && sudo chown -R $USER:$USER lede
[ ! -e lede/.git ] && (cd lede && git init && git remote add -t openwrt-18.06-k5.4 -f origin https://github.com/immortalwrt/immortalwrt && git checkout openwrt-18.06-k5.4) [ ! -e lede/.git ] && (cd lede && git init && git remote add -t openwrt-18.06-k5.4 -f origin https://github.com/immortalwrt/immortalwrt && git checkout openwrt-18.06-k5.4)
cd lede && git config --local user.email "action@github.com" && git config --local user.name "GitHub Action" && git pull -X theirs cd lede && git config --local user.email "action@github.com" && git config --local user.name "GitHub Action" && git pull --ff-only -X theirs
- name: Update feeds and packages - name: Update feeds and packages
run: | run: |
@@ -140,7 +140,7 @@ jobs:
echo $ret | jq -r '.assets[] | select(.name | contains ("'${{ github.event.client_payload.device }}'")).id' | \ echo $ret | jq -r '.assets[] | select(.name | contains ("'${{ github.event.client_payload.device }}'")).id' | \
xargs -n1 -i curl -X DELETE -H "$AUTH" "https://api.$cache_path/assets/{}" 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 \ 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.'${{ github.event.client_payload.device }}'.img.0{#} > /dev/null' 'curl -s --data-binary @- -H "$AUTH" -H "Content-Type: application/octet-stream" https://uploads.$cache_path/$cache_repo_id/assets?name=lede.'${{ github.event.client_payload.device }}'.img.zst.0{#} > /dev/null'
- name: Debug via tmate - name: Debug via tmate
uses: P3TERX/ssh2actions@main uses: P3TERX/ssh2actions@main