Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,24 @@ else
fi
INSTALL_PATH="${RUNNER_TOOL_CACHE}${SEP}.hatch"

curl_opts=(
--fail # fail on HTTP errors (>=400), prevents saving an error page
--silent # no progress meter or extra output
--show-error # but still show errors (important for debugging)
--location # follow redirects
--retry 2 # retry N more times on transient errors
--retry-connrefused # also if connection is refused (CDN saturation cases)
)

install_hatch() {
mkdir -p "${INSTALL_PATH}"
archive="${INSTALL_PATH}${SEP}$1"

echo -e "${PURPLE}Downloading Hatch ${VERSION}${RESET}\n"
if [[ "${VERSION}" == "latest" ]]; then
curl -sSLo "${archive}" "https://github.com/pypa/hatch/releases/latest/download/$1"
curl "${curl_opts[@]}" -o "${archive}" "https://github.com/pypa/hatch/releases/latest/download/$1"
else
curl -sSLo "${archive}" "https://github.com/pypa/hatch/releases/download/hatch-v${VERSION}/$1"
curl "${curl_opts[@]}" -o "${archive}" "https://github.com/pypa/hatch/releases/download/hatch-v${VERSION}/$1"
fi

if [[ "${archive}" =~ \.zip$ ]]; then
Expand Down
Loading