Commit 87b8893d4a
Unsigned
Layout: unified · split
Build/release +12 −10
| @@ -12,10 +12,6 @@ installer_script="Build/curd-windows-build.iss" | |||
| 12 | mkdir -p "$windows_folder" "$linux_folder" "$macos_folder" | 12 | mkdir -p "$windows_folder" "$linux_folder" "$macos_folder" |
| 13 | mkdir -p "$windows_folder/bin" | 13 | mkdir -p "$windows_folder/bin" |
| 14 | 14 | ||
| 15 | # Uncompress mpv.exe.gz | ||
| 16 | echo "Uncompressing mpv.exe..." | ||
| 17 | gunzip -c Build/mpv.exe.gz > "Build/mpv.exe" | ||
| 18 | |||
| 19 | # Update version in the installer script | 15 | # Update version in the installer script |
| 20 | sed -i "s/^AppVersion=.*/AppVersion=$version/" "$installer_script" | 16 | sed -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 |
| 31 | if [ -f "curd" ]; then | 27 | if [ -f "curd" ]; then |
| 32 | mv curd "$linux_folder/" | 28 | mv curd "$linux_folder/curd-linux-x86_64" |
| 33 | else | 29 | else |
| 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 | |||
| 39 | echo "Building macOS binaries..." | 35 | echo "Building macOS binaries..." |
| 40 | bash Build/buildmac | 36 | bash Build/buildmac |
| 41 | if [ -f "curd" ]; then | 37 | if [ -f "curd" ]; then |
| 42 | mv curd "$macos_folder/curd-amd64" | 38 | mv curd "$macos_folder/curd-macos-x86_64" |
| 43 | else | 39 | else |
| 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 | ||
| 48 | bash Build/buildmac-arm64 | 44 | bash Build/buildmac-arm64 |
| 49 | if [ -f "curd" ]; then | 45 | if [ -f "curd" ]; then |
| 50 | mv curd "$macos_folder/curd-arm64" | 46 | mv curd "$macos_folder/curd-macos-arm64" |
| 51 | else | 47 | else |
| 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 |
| 57 | echo "Creating macOS Universal binary..." | 53 | echo "Creating macOS Universal binary..." |
| 58 | lipo -create "$macos_folder/curd-amd64" "$macos_folder/curd-arm64" -output "$macos_folder/curd" | 54 | llvm-lipo -create "$macos_folder/curd-amd64" "$macos_folder/curd-arm64" -output "$macos_folder/curd" |
| 59 | rm "$macos_folder/curd-amd64" "$macos_folder/curd-arm64" | 55 | rm "$macos_folder/curd-amd64" "$macos_folder/curd-arm64" |
| 60 | 56 | ||
| 61 | # Build Windows binary | 57 | # Build Windows binary |
| 62 | echo "Building Windows binary..." | 58 | echo "Building Windows binary..." |
| 63 | bash Build/buildwindows | 59 | bash Build/buildwindows |
| 64 | 60 | ||
| 61 | # Uncompress mpv.exe.gz | ||
| 62 | echo "Uncompressing mpv.exe..." | ||
| 63 | gunzip -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 |
| 66 | if [ -f "curd.exe" ]; then | 66 | if [ -f "curd.exe" ]; then |
| 67 | mv curd.exe "$windows_folder/" | 67 | mv curd.exe "$windows_folder/curd-windows.exe" |
| 68 | else | 68 | else |
| 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 |
| 85 | installer_output="Build/Output/CurdInstaller.exe" # Replace with actual output location if different | 85 | installer_output="Build/Output/CurdInstaller.exe" # Replace with actual output location if different |
| 86 | if [ -f "$installer_output" ]; then | 86 | if [ -f "$installer_output" ]; then |
| 87 | mv "$installer_output" "$windows_folder/CurdInstaller.exe" | 87 | mv "$installer_output" "$windows_folder/Curd-Windows-Installer.exe" |
| 88 | else | 88 | else |
| 89 | echo "Installer creation failed. Please check Inno Setup script output." | 89 | echo "Installer creation failed. Please check Inno Setup script output." |
| 90 | fi | 90 | fi |
| 91 | 91 | ||
| 92 | rm "Build/mpv.exe" | ||
| 93 | |||
| 92 | echo "Release build completed in $release_folder." | 94 | echo "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 | ||
| 20 | func GetTokenFromFile(filePath string) (string, error) { | 21 | func 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" |