feat: avoid redundant binary downloads and notify when skipping

- Skip downloading the binary if it already exists, and print a message instead

Signed-off-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
appleboy 2025-08-31 10:10:22 +08:00
parent 9132c85c5f
commit 775954b583
No known key found for this signature in database

View File

@ -39,8 +39,12 @@ if [[ "${INPUT_CURL_INSECURE}" == 'true' ]]; then
INSECURE_OPTION="--insecure"
fi
curl -fsSL --retry 5 --keepalive-time 2 ${INSECURE_OPTION} "${DOWNLOAD_URL_PREFIX}/${CLIENT_BINARY}" -o "${TARGET}"
chmod +x "${TARGET}"
if [[ ! -f "${TARGET}" ]]; then
curl -fsSL --retry 5 --keepalive-time 2 ${INSECURE_OPTION} "${DOWNLOAD_URL_PREFIX}/${CLIENT_BINARY}" -o "${TARGET}"
chmod +x "${TARGET}"
else
echo "Binary ${CLIENT_BINARY} already exists, skipping download."
fi
echo "======= CLI Version Information ======="
"${TARGET}" --version