From 1f1f4144bbb55b4512648afa74bfe5e690535423 Mon Sep 17 00:00:00 2001 From: dacrab Date: Fri, 27 Dec 2024 13:42:42 +0200 Subject: [PATCH] fix: update release file names and install scripts --- .goreleaser.yml | 6 +++--- scripts/install.ps1 | 11 ++++++----- scripts/install.sh | 22 ++++++++++++++-------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index e324890..eb448d2 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -30,14 +30,14 @@ archives: - id: binary format: binary name_template: >- - {{ .Binary }}_ + {{ .Binary }} + {{- if eq .Os "windows" }}.exe{{ else }}_ {{- .Os }}_ {{- if eq .Arch "amd64" }}x64{{ end }} {{- if eq .Arch "386" }}x86{{ end }} {{- if eq .Arch "arm64" }}arm64{{ end }} {{- if and (eq .Os "darwin") (eq .Arch "amd64") }}_intel{{ end }} - {{- if and (eq .Os "darwin") (eq .Arch "arm64") }}_apple_silicon{{ end }} - {{- if eq .Os "windows" }}.exe{{ end }} + {{- if and (eq .Os "darwin") (eq .Arch "arm64") }}_apple_silicon{{ end }}{{ end }} checksum: name_template: 'checksums.txt' diff --git a/scripts/install.ps1 b/scripts/install.ps1 index 747b65b..a851bac 100644 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -37,9 +37,9 @@ trap { # Detect system architecture function Get-SystemArch { if ([Environment]::Is64BitOperatingSystem) { - return "amd64" + return "x64" } else { - return "386" + return "x86" } } @@ -79,11 +79,12 @@ function Install-CursorModifier { # Get latest release try { - $latestRelease = Invoke-RestMethod -Uri "https://api.github.com/repos/dacrab/cursor-id-modifier/releases/latest" - $downloadUrl = $latestRelease.assets | Where-Object { $_.name -match "windows_$arch" } | Select-Object -ExpandProperty browser_download_url + $latestRelease = Invoke-RestMethod -Uri "https://api.github.com/repos/dacrab/go-cursor-help/releases/latest" + $binaryName = "cursor-id-modifier.exe" + $downloadUrl = $latestRelease.assets | Where-Object { $_.name -eq $binaryName } | Select-Object -ExpandProperty browser_download_url if (!$downloadUrl) { - throw "Could not find download URL for windows_$arch" + throw "Could not find download URL for $binaryName" } } catch { diff --git a/scripts/install.sh b/scripts/install.sh index 2112421..c528a5f 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -15,7 +15,7 @@ trap 'rm -rf "$TMP_DIR"' EXIT # Detect system information detect_system() { - local os arch + local os arch suffix case "$(uname -s)" in Linux*) os="linux";; @@ -24,13 +24,18 @@ detect_system() { esac case "$(uname -m)" in - x86_64) arch="amd64";; - aarch64) arch="arm64";; - arm64) arch="arm64";; + x86_64) + arch="x64" + [ "$os" = "darwin" ] && suffix="_intel" + ;; + aarch64|arm64) + arch="arm64" + [ "$os" = "darwin" ] && suffix="_apple_silicon" + ;; *) echo "Unsupported architecture"; exit 1;; esac - echo "$os $arch" + echo "$os $arch $suffix" } # Download with progress using curl or wget @@ -65,7 +70,7 @@ main() { echo -e "${BLUE}Starting installation...${NC}" # Detect system - read -r OS ARCH <<< "$(detect_system)" + read -r OS ARCH SUFFIX <<< "$(detect_system)" echo -e "${GREEN}Detected: $OS $ARCH${NC}" # Set installation directory @@ -76,8 +81,9 @@ main() { setup_install_dir "$INSTALL_DIR" # Download latest release - LATEST_URL="https://api.github.com/repos/dacrab/cursor-id-modifier/releases/latest" - DOWNLOAD_URL=$(curl -s "$LATEST_URL" | grep "browser_download_url.*${OS}_${ARCH}" | cut -d '"' -f 4) + LATEST_URL="https://api.github.com/repos/dacrab/go-cursor-help/releases/latest" + BINARY_NAME="cursor-id-modifier_${OS}_${ARCH}${SUFFIX}" + DOWNLOAD_URL=$(curl -s "$LATEST_URL" | grep "browser_download_url.*${BINARY_NAME}" | cut -d '"' -f 4) if [ -z "$DOWNLOAD_URL" ]; then echo -e "${RED}Error: Could not find download URL for $OS $ARCH${NC}"