From 6f7fd358d62d88d6333374d67158db9c2e9ba431 Mon Sep 17 00:00:00 2001 From: Ing Date: Sat, 27 Sep 2025 03:37:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=95=B0=E6=8D=AE=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E9=80=BB=E8=BE=91=EF=BC=8C=E6=B7=BB=E5=8A=A0=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E5=A4=B1=E8=B4=A5=E9=87=8D=E8=AF=95=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/data.yml | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/data.yml b/.github/workflows/data.yml index 04c4c70f..0d165560 100644 --- a/.github/workflows/data.yml +++ b/.github/workflows/data.yml @@ -33,27 +33,30 @@ jobs: git config --global user.name "github-actions[bot]" sudo timedatectl set-timezone "Asia/Shanghai" - - name: Delay - run: | - echo "Delaying for 1 minutes..." - sleep 60 - - name: Get Data run: | REPO="${{ github.server_url }}/${{ github.repository }}" PRERELEASE="true" TAG="" - if [ "${PRERELEASE}" = "true" ]; then - TAG="$(curl -skL --connect-timeout 10 "${REPO}/tags" | grep "/refs/tags/.*\.zip" | sed -E 's/.*\/refs\/tags\/(.*)\.zip.*$/\1/' | sort -rV | head -1)" - else - TAG="$(curl -skL --connect-timeout 10 -w "%{url_effective}" -o /dev/null "${REPO}/releases/latest" | awk -F'/' '{print $NF}')" - fi - [ "${TAG:0:1}" = "v" ] && TAG="${TAG:1}" - rm -f rr-${TAG}.img.zip - STATUS=$(curl -kL --connect-timeout 10 -w "%{http_code}" "${REPO}/releases/download/${TAG}/rr-${TAG}.img.zip" -o "rr-${TAG}.img.zip") - if [ $? -ne 0 ] || [ ${STATUS:-0} -ne 200 ]; then - echo "Download failed" + for i in {1..3}; do + if [ "${PRERELEASE}" = "true" ]; then + TAG="$(curl -skL --connect-timeout 10 "${REPO}/tags" | grep "/refs/tags/.*\.zip" | sed -E 's/.*\/refs\/tags\/(.*)\.zip.*$/\1/' | sort -rV | head -1)" + else + TAG="$(curl -skL --connect-timeout 10 -w "%{url_effective}" -o /dev/null "${REPO}/releases/latest" | awk -F'/' '{print $NF}')" + fi + [ "${TAG:0:1}" = "v" ] && TAG="${TAG:1}" + rm -f rr-${TAG}.img.zip + STATUS=$(curl -kL --connect-timeout 10 -w "%{http_code}" "${REPO}/releases/download/${TAG}/rr-${TAG}.img.zip" -o "rr-${TAG}.img.zip") + if [ $? -eq 0 ] && [ ${STATUS:-0} -eq 200 ]; then + break + else + echo "Download failed, retry $i/3" + sleep 60 + fi + done + if [ ! -f "rr-${TAG}.img.zip" ] || [ ${STATUS:-0} -ne 200 ]; then + echo "Download failed after 3 attempts" exit 1 fi