mirror of
https://github.com/netbirdio/netbird.git
synced 2026-03-31 06:34:14 -04:00
[misc] Update tag name extraction in install.sh (#4677)
This commit is contained in:
@@ -29,6 +29,8 @@ if [ -z ${NETBIRD_RELEASE+x} ]; then
|
||||
NETBIRD_RELEASE=latest
|
||||
fi
|
||||
|
||||
TAG_NAME=""
|
||||
|
||||
get_release() {
|
||||
local RELEASE=$1
|
||||
if [ "$RELEASE" = "latest" ]; then
|
||||
@@ -38,17 +40,19 @@ get_release() {
|
||||
local TAG="tags/${RELEASE}"
|
||||
local URL="https://api.github.com/repos/${OWNER}/${REPO}/releases/${TAG}"
|
||||
fi
|
||||
OUTPUT=""
|
||||
if [ -n "$GITHUB_TOKEN" ]; then
|
||||
curl -H "Authorization: token ${GITHUB_TOKEN}" -s "${URL}" \
|
||||
| grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
|
||||
OUTPUT=$(curl -H "Authorization: token ${GITHUB_TOKEN}" -s "${URL}")
|
||||
else
|
||||
curl -s "${URL}" \
|
||||
| grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
|
||||
OUTPUT=$(curl -s "${URL}")
|
||||
fi
|
||||
TAG_NAME=$(echo ${OUTPUT} | grep -Eo '\"tag_name\":\s*\"v([0-9]+\.){2}[0-9]+"' | tail -n 1)
|
||||
echo "${TAG_NAME}" | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+'
|
||||
}
|
||||
|
||||
download_release_binary() {
|
||||
VERSION=$(get_release "$NETBIRD_RELEASE")
|
||||
echo "Using the following tag name for binary installation: ${TAG_NAME}"
|
||||
BASE_URL="https://github.com/${OWNER}/${REPO}/releases/download"
|
||||
BINARY_BASE_NAME="${VERSION#v}_${OS_TYPE}_${ARCH}.tar.gz"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user