Browse Source

fix: update release file names and install scripts

pull/85/head
dacrab 5 months ago
parent
commit
1f1f4144bb
  1. 6
      .goreleaser.yml
  2. 11
      scripts/install.ps1
  3. 22
      scripts/install.sh

6
.goreleaser.yml

@ -30,14 +30,14 @@ archives:
- id: binary - id: binary
format: binary format: binary
name_template: >- name_template: >-
{{ .Binary }}_
{{ .Binary }}
{{- if eq .Os "windows" }}.exe{{ else }}_
{{- .Os }}_ {{- .Os }}_
{{- if eq .Arch "amd64" }}x64{{ end }} {{- if eq .Arch "amd64" }}x64{{ end }}
{{- if eq .Arch "386" }}x86{{ end }} {{- if eq .Arch "386" }}x86{{ end }}
{{- if eq .Arch "arm64" }}arm64{{ end }} {{- if eq .Arch "arm64" }}arm64{{ end }}
{{- if and (eq .Os "darwin") (eq .Arch "amd64") }}_intel{{ 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: checksum:
name_template: 'checksums.txt' name_template: 'checksums.txt'

11
scripts/install.ps1

@ -37,9 +37,9 @@ trap {
# Detect system architecture # Detect system architecture
function Get-SystemArch { function Get-SystemArch {
if ([Environment]::Is64BitOperatingSystem) { if ([Environment]::Is64BitOperatingSystem) {
return "amd64"
return "x64"
} else { } else {
return "386"
return "x86"
} }
} }
@ -79,11 +79,12 @@ function Install-CursorModifier {
# Get latest release # Get latest release
try { 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) { if (!$downloadUrl) {
throw "Could not find download URL for windows_$arch"
throw "Could not find download URL for $binaryName"
} }
} }
catch { catch {

22
scripts/install.sh

@ -15,7 +15,7 @@ trap 'rm -rf "$TMP_DIR"' EXIT
# Detect system information # Detect system information
detect_system() { detect_system() {
local os arch
local os arch suffix
case "$(uname -s)" in case "$(uname -s)" in
Linux*) os="linux";; Linux*) os="linux";;
@ -24,13 +24,18 @@ detect_system() {
esac esac
case "$(uname -m)" in 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;; *) echo "Unsupported architecture"; exit 1;;
esac esac
echo "$os $arch"
echo "$os $arch $suffix"
} }
# Download with progress using curl or wget # Download with progress using curl or wget
@ -65,7 +70,7 @@ main() {
echo -e "${BLUE}Starting installation...${NC}" echo -e "${BLUE}Starting installation...${NC}"
# Detect system # Detect system
read -r OS ARCH <<< "$(detect_system)"
read -r OS ARCH SUFFIX <<< "$(detect_system)"
echo -e "${GREEN}Detected: $OS $ARCH${NC}" echo -e "${GREEN}Detected: $OS $ARCH${NC}"
# Set installation directory # Set installation directory
@ -76,8 +81,9 @@ main() {
setup_install_dir "$INSTALL_DIR" setup_install_dir "$INSTALL_DIR"
# Download latest release # 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 if [ -z "$DOWNLOAD_URL" ]; then
echo -e "${RED}Error: Could not find download URL for $OS $ARCH${NC}" echo -e "${RED}Error: Could not find download URL for $OS $ARCH${NC}"

Loading…
Cancel
Save