Add retry for release steps to download geofiles

This commit is contained in:
yuhan6665 2022-12-18 20:01:56 -05:00
parent a55cf1d0bf
commit 48a75fc340

View File

@ -161,21 +161,26 @@ jobs:
mv xray xray.exe mv xray xray.exe
- name: Prepare to release - name: Prepare to release
run: | uses: nick-fields/retry@v2
cp ${GITHUB_WORKSPACE}/README.md ./build_assets/README.md with:
cp ${GITHUB_WORKSPACE}/LICENSE ./build_assets/LICENSE timeout_minutes: 60
LIST=('geoip geoip geoip' 'domain-list-community dlc geosite') retry_wait_seconds: 60
for i in "${LIST[@]}" max_attempts: 60
do command: |
INFO=($(echo $i | awk 'BEGIN{FS=" ";OFS=" "} {print $1,$2,$3}')) cp ${GITHUB_WORKSPACE}/README.md ./build_assets/README.md
LASTEST_TAG="$(curl -sL "https://api.github.com/repos/v2fly/${INFO[0]}/releases" | jq -r ".[0].tag_name" || echo "latest")" cp ${GITHUB_WORKSPACE}/LICENSE ./build_assets/LICENSE
FILE_NAME="${INFO[2]}.dat" LIST=('geoip geoip geoip' 'domain-list-community dlc geosite')
echo -e "Downloading ${FILE_NAME}..." for i in "${LIST[@]}"
curl -L "https://github.com/v2fly/${INFO[0]}/releases/download/${LASTEST_TAG}/${INFO[1]}.dat" -o ./build_assets/${FILE_NAME} do
echo -e "Verifying HASH key..." INFO=($(echo $i | awk 'BEGIN{FS=" ";OFS=" "} {print $1,$2,$3}'))
HASH="$(curl -sL "https://github.com/v2fly/${INFO[0]}/releases/download/${LASTEST_TAG}/${INFO[1]}.dat.sha256sum" | awk -F ' ' '{print $1}')" LASTEST_TAG="$(curl -sL "https://api.github.com/repos/v2fly/${INFO[0]}/releases/latest" | jq -r ".tag_name" || echo "latest")"
[ "$(sha256sum "./build_assets/${FILE_NAME}" | awk -F ' ' '{print $1}')" == "${HASH}" ] || { echo -e "The HASH key of ${FILE_NAME} does not match cloud one."; exit 1; } FILE_NAME="${INFO[2]}.dat"
done echo -e "Downloading https://github.com/v2fly/${INFO[0]}/releases/download/${LASTEST_TAG}/${INFO[1]}.dat..."
curl -L "https://github.com/v2fly/${INFO[0]}/releases/download/${LASTEST_TAG}/${INFO[1]}.dat" -o ./build_assets/${FILE_NAME}
echo -e "Verifying HASH key..."
HASH="$(curl -sL "https://github.com/v2fly/${INFO[0]}/releases/download/${LASTEST_TAG}/${INFO[1]}.dat.sha256sum" | awk -F ' ' '{print $1}')"
[ "$(sha256sum "./build_assets/${FILE_NAME}" | awk -F ' ' '{print $1}')" == "${HASH}" ] || { echo -e "The HASH key of ${FILE_NAME} does not match cloud one."; exit 1; }
done
- name: Create ZIP archive - name: Create ZIP archive
shell: bash shell: bash