mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
chore: extract version from latest redirect in install_cli.sh (#180)
This commit is contained in:
@@ -20,12 +20,8 @@ print_manual_install() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fetch_latest_version() {
|
fetch_latest_version() {
|
||||||
api_url="https://api.github.com/repos/${GITHUB_REPO}/releases/latest"
|
latest_url="https://github.com/${GITHUB_REPO}/releases/latest"
|
||||||
auth_header=""
|
VERSION=$(curl -fsSLI -o /dev/null -w '%{url_effective}' "$latest_url" | grep -o 'tag/[^/]*$' | cut -d'/' -f2)
|
||||||
if [ -n "$GITHUB_TOKEN" ]; then
|
|
||||||
auth_header="Authorization: Bearer $GITHUB_TOKEN"
|
|
||||||
fi
|
|
||||||
VERSION=$(curl -fsSL -H "$auth_header" "$api_url" | grep -o '"tag_name": "[^"]*' | cut -d'"' -f4)
|
|
||||||
if [ -z "$VERSION" ]; then
|
if [ -z "$VERSION" ]; then
|
||||||
echo "Failed to fetch the latest version from GitHub."
|
echo "Failed to fetch the latest version from GitHub."
|
||||||
print_manual_install
|
print_manual_install
|
||||||
|
|||||||
Reference in New Issue
Block a user