From ce26d5abba8950f30bad1d992a2481bf252359b7 Mon Sep 17 00:00:00 2001
From: Pytgaen <32298455+pytgaen@users.noreply.github.com>
Date: Sat, 18 May 2024 22:58:12 +0200
Subject: [PATCH] fix: issue #73 github_get_latest_version

---
 templates/gitlab-ci-python.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/gitlab-ci-python.yml b/templates/gitlab-ci-python.yml
index 26e1c3b..ce84ae3 100644
--- a/templates/gitlab-ci-python.yml
+++ b/templates/gitlab-ci-python.yml
@@ -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])"
-- 
GitLab