Skip to content
Snippets Groups Projects
Commit ce26d5ab authored by Pytgaen's avatar Pytgaen
Browse files

fix: issue #73 github_get_latest_version

parent 3693e7f3
No related branches found
No related tags found
No related merge requests found
......@@ -844,7 +844,7 @@ variables:
function github_get_latest_version() {
if command -v curl &> /dev/null
then
curl -sSf -I "https://github.com/$1/releases/latest" | awk -F '/' '/location:/ {print $NF}'
curl -sSf -I "https://github.com/$1/releases/latest" | awk -F '/' '/location:/ {sub(/(\r|\n)*$/, "", $NF); print $NF}'
elif command -v python3 &> /dev/null
then
python3 -c "import urllib.request;url='https://github.com/$1/releases/latest';opener=urllib.request.build_opener(type('NoRedirection', (urllib.request.HTTPErrorProcessor,), {'http_response': lambda self, req, resp: resp, 'https_response': lambda self, req, resp: resp})());req=urllib.request.Request(url, method='HEAD');print(opener.open(req).headers.get('Location').split('/')[-1])"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment