Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Commit

Permalink
refactor: check_alist.sh 失败自动重试
Browse files Browse the repository at this point in the history
  • Loading branch information
jing332 committed Aug 20, 2023
1 parent 26a1563 commit b2aa5e4
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions .github/scripts/check_alist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,35 @@ function to_int() {
echo $(echo "$1" | grep -oE '[0-9]+' | tr -d '\n')
}

LATEST_VER=$(curl -s https://api.github.com/repos/alist-org/alist/releases/latest | grep -o '"tag_name": ".*"' | cut -d'"' -f4)
function get_latest_version() {
echo $(curl -s https://api.github.com/repos/alist-org/alist/releases/latest | grep -o '"tag_name": ".*"' | cut -d'"' -f4)
}

LATEST_VER=""
for index in $(seq 5)
do
echo "Try to get latest version, index=$index"
LATEST_VER=$(get_latest_version)
if [ -z $LATEST_VER ]; then
echo "Failed to get latest version, sleep 5s and retry"
sleep 5
else
break
fi

done

LATEST_VER_INT=$(to_int $LATEST_VER)
echo "Latest AList version $LATEST_VER ${LATEST_VER_INT}"
echo "alist_version=$LATEST_VER" >> $GITHUB_ENV

echo "alist_version=$LATEST_VER" >> $GITHUB_ENV
# VERSION_FILE="$GITHUB_WORKSPACE/alist_version.txt"

VER=$(cat $VERSION_FILE)

if [ -z $VER ]; then
VER="v3.25.1"
echo "No version file, use default version ${VER}"
fi

VER_INT=$(to_int $VER)
Expand Down

0 comments on commit b2aa5e4

Please sign in to comment.