Skip to content

Commit

Permalink
win: fix curl dler on win gha
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed Jul 22, 2024
1 parent ca42990 commit b1ab688
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions script/lib/download-file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,21 @@ function download_to {
debug_log "about to download"
URL="$1"
OUTPUT_FILE="$2"
echo "doing curl of: '$URL', saving in $OUTPUT_FILE"
debug_log "doing curl of: '$URL', saving in $OUTPUT_FILE"

HTTP_CODE="$(curl --silent --output "$OUTPUT_FILE" --write-out "%{http_code}" --location "$URL")"
if [[ "$(uname -m)" == "Darwin" ]] || [[ "$(uname -m)" == "Linux" ]]; then
HTTP_CODE="$(curl --silent --output "$OUTPUT_FILE" --write-out "%{http_code}" --location "$URL")"
else
# temp workaround for curl 8.8.x error on windows gha runners
# https://github.com/curl/curl/issues/13845
curl --silent --output "$OUTPUT_FILE" --location "$URL"
if [ $? -ne 0 ]; then
error "Unable to download file at url ${URL}"
exit 1
else
HTTP_CODE=200
fi
fi
debug_log "did curl, http code was '${HTTP_CODE}'"
if [[ "${HTTP_CODE}" -lt 200 || "${HTTP_CODE}" -gt 299 ]] ; then
error "Unable to download file at url ${URL}"
Expand Down

0 comments on commit b1ab688

Please sign in to comment.