Commit 87b8893d4a

87b8893d4abc6525ea73f2f4f29a163af5dd9d8c

parent: ee5a90cb82

Unsigned

Wraient <wraient.911@gmail.com> · 2025-02-05 16:45 UTC

Fix: Update curd and release script

Layout: unified · split

Build/release +12 −10
@@ -12,10 +12,6 @@ installer_script="Build/curd-windows-build.iss"
12mkdir -p "$windows_folder" "$linux_folder" "$macos_folder" 12mkdir -p "$windows_folder" "$linux_folder" "$macos_folder"
13mkdir -p "$windows_folder/bin" 13mkdir -p "$windows_folder/bin"
14 14
15# Uncompress mpv.exe.gz
16echo "Uncompressing mpv.exe..."
17gunzip -c Build/mpv.exe.gz > "Build/mpv.exe"
18
19# Update version in the installer script 15# Update version in the installer script
20sed -i "s/^AppVersion=.*/AppVersion=$version/" "$installer_script" 16sed -i "s/^AppVersion=.*/AppVersion=$version/" "$installer_script"
21 17
@@ -29,7 +25,7 @@ bash Build/buildlinux
29 25
30# Move the Linux binary to the release folder 26# Move the Linux binary to the release folder
31if [ -f "curd" ]; then 27if [ -f "curd" ]; then
32 mv curd "$linux_folder/" 28 mv curd "$linux_folder/curd-linux-x86_64"
33else 29else
34 echo "Linux build failed. Please check Build/buildlinux." 30 echo "Linux build failed. Please check Build/buildlinux."
35 exit 1 31 exit 1
@@ -39,7 +35,7 @@ fi
39echo "Building macOS binaries..." 35echo "Building macOS binaries..."
40bash Build/buildmac 36bash Build/buildmac
41if [ -f "curd" ]; then 37if [ -f "curd" ]; then
42 mv curd "$macos_folder/curd-amd64" 38 mv curd "$macos_folder/curd-macos-x86_64"
43else 39else
44 echo "macOS Intel build failed. Please check Build/buildmac." 40 echo "macOS Intel build failed. Please check Build/buildmac."
45 exit 1 41 exit 1
@@ -47,7 +43,7 @@ fi
47 43
48bash Build/buildmac-arm64 44bash Build/buildmac-arm64
49if [ -f "curd" ]; then 45if [ -f "curd" ]; then
50 mv curd "$macos_folder/curd-arm64" 46 mv curd "$macos_folder/curd-macos-arm64"
51else 47else
52 echo "macOS ARM build failed. Please check Build/buildmac-arm64." 48 echo "macOS ARM build failed. Please check Build/buildmac-arm64."
53 exit 1 49 exit 1
@@ -55,16 +51,20 @@ fi
55 51
56# Create Universal binary for macOS 52# Create Universal binary for macOS
57echo "Creating macOS Universal binary..." 53echo "Creating macOS Universal binary..."
58lipo -create "$macos_folder/curd-amd64" "$macos_folder/curd-arm64" -output "$macos_folder/curd" 54llvm-lipo -create "$macos_folder/curd-amd64" "$macos_folder/curd-arm64" -output "$macos_folder/curd"
59rm "$macos_folder/curd-amd64" "$macos_folder/curd-arm64" 55rm "$macos_folder/curd-amd64" "$macos_folder/curd-arm64"
60 56
61# Build Windows binary 57# Build Windows binary
62echo "Building Windows binary..." 58echo "Building Windows binary..."
63bash Build/buildwindows 59bash Build/buildwindows
64 60
61# Uncompress mpv.exe.gz
62echo "Uncompressing mpv.exe..."
63gunzip -c Build/mpv.exe.gz > "Build/mpv.exe"
64
65# Move the Windows binary to the release folder 65# Move the Windows binary to the release folder
66if [ -f "curd.exe" ]; then 66if [ -f "curd.exe" ]; then
67 mv curd.exe "$windows_folder/" 67 mv curd.exe "$windows_folder/curd-windows.exe"
68else 68else
69 echo "Windows build failed. Please check Build/buildwindows." 69 echo "Windows build failed. Please check Build/buildwindows."
70 exit 1 70 exit 1
@@ -84,9 +84,11 @@ wine "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "$installer_script"
84# Move installer to the release folder 84# Move installer to the release folder
85installer_output="Build/Output/CurdInstaller.exe" # Replace with actual output location if different 85installer_output="Build/Output/CurdInstaller.exe" # Replace with actual output location if different
86if [ -f "$installer_output" ]; then 86if [ -f "$installer_output" ]; then
87 mv "$installer_output" "$windows_folder/CurdInstaller.exe" 87 mv "$installer_output" "$windows_folder/Curd-Windows-Installer.exe"
88else 88else
89 echo "Installer creation failed. Please check Inno Setup script output." 89 echo "Installer creation failed. Please check Inno Setup script output."
90fi 90fi
91 91
92rm "Build/mpv.exe"
93
92echo "Release build completed in $release_folder." 94echo "Release build completed in $release_folder."
internal/curd.go +27 −5
@@ -8,13 +8,14 @@ import (
8 "net/http" 8 "net/http"
9 "os" 9 "os"
10 "os/exec" 10 "os/exec"
11 "github.com/gen2brain/beeep"
12 "path/filepath" 11 "path/filepath"
13 "regexp" 12 "regexp"
14 "runtime" 13 "runtime"
15 "strconv" 14 "strconv"
16 "strings" 15 "strings"
17 "time" 16 "time"
17
18 "github.com/gen2brain/beeep"
18) 19)
19 20
20func GetTokenFromFile(filePath string) (string, error) { 21func GetTokenFromFile(filePath string) (string, error) {
@@ -438,13 +439,34 @@ func UpdateCurd(repo, fileName string) error {
438 return fmt.Errorf("unable to find current executable: %v", err) 439 return fmt.Errorf("unable to find current executable: %v", err)
439 } 440 }
440 441
441 // Adjust file name for Windows 442 // Determine the correct binary name based on OS and architecture
442 if runtime.GOOS == "windows" { 443 var binaryName string
443 fileName += ".exe" 444 switch runtime.GOOS {
445 case "windows":
446 if strings.HasSuffix(executablePath, "curd.exe") {
447 binaryName = "curd-windows.exe"
448 }
449 case "darwin": // macOS
450 switch runtime.GOARCH {
451 case "amd64":
452 binaryName = "curd-macos-x86_64"
453 case "arm64":
454 binaryName = "curd-macos-arm64"
455 default:
456 binaryName = "curd-macos-universal"
457 }
458 case "linux":
459 if runtime.GOARCH == "amd64" {
460 binaryName = "curd-linux-x86_64"
461 } else {
462 return fmt.Errorf("unsupported Linux architecture: %s", runtime.GOARCH)
463 }
464 default:
465 return fmt.Errorf("unsupported operating system: %s", runtime.GOOS)
444 } 466 }
445 467
446 // GitHub release URL for curd 468 // GitHub release URL for curd
447 url := fmt.Sprintf("https://github.com/%s/releases/latest/download/%s", repo, fileName) 469 url := fmt.Sprintf("https://github.com/%s/releases/latest/download/%s", repo, binaryName)
448 470
449 // Temporary path for the downloaded curd executable 471 // Temporary path for the downloaded curd executable
450 tmpPath := executablePath + ".tmp" 472 tmpPath := executablePath + ".tmp"