feat: implement Linux auto-installation and update Windows build process to use NSIS installer

This commit is contained in:
2026-06-09 12:51:43 +01:00
parent 3d4cfd86d5
commit 8a9a34363f
3 changed files with 66 additions and 3 deletions
+3 -3
View File
@@ -30,8 +30,8 @@ jobs:
cp build/bin/goexplore dist/goexplore-linux-amd64
# Windows amd64
wails build -platform windows/amd64 -clean
cp build/bin/goexplore.exe dist/goexplore-windows-amd64.exe
wails build -platform windows/amd64 -clean -nsis
cp build/bin/goexplore-amd64-installer.exe dist/goexplore-windows-installer.exe
"
@@ -44,7 +44,7 @@ jobs:
R2_ENDPOINT: ${{ secrets.R2_ENDPOINT_URL }}
run: |
aws s3 cp dist/goexplore-linux-amd64 s3://apps/goexplore/goexplore-linux-amd64 --endpoint-url "$R2_ENDPOINT"
aws s3 cp dist/goexplore-windows-amd64.exe s3://apps/goexplore/goexplore-windows-amd64.exe --endpoint-url "$R2_ENDPOINT"
aws s3 cp dist/goexplore-windows-installer.exe s3://apps/goexplore/goexplore-windows-installer.exe --endpoint-url "$R2_ENDPOINT"
- name: Clean up
run: sudo rm -rf dist build/bin/*
+1
View File
@@ -5,6 +5,7 @@ RUN apt-get update && apt-get install -y \
curl \
gcc \
mingw-w64 \
nsis \
libgtk-3-dev \
libwebkit2gtk-4.1-dev \
&& rm -rf /var/lib/apt/lists/*
+62
View File
@@ -2,6 +2,11 @@ package main
import (
"embed"
"fmt"
"os"
"os/exec"
"path/filepath"
"runtime"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options"
@@ -15,7 +20,64 @@ var assets embed.FS
//go:embed build/appicon.png
var icon []byte
func installLinux() {
if runtime.GOOS != "linux" {
return
}
exe, err := os.Executable()
if err != nil {
return
}
home, err := os.UserHomeDir()
if err != nil {
return
}
targetDir := filepath.Join(home, ".local", "bin")
targetExe := filepath.Join(targetDir, "goexplore")
// If we are already running from the target path, do nothing.
if exe == targetExe {
return
}
// Ensure target directories exist
os.MkdirAll(targetDir, 0755)
// Copy the executable
data, err := os.ReadFile(exe)
if err == nil {
os.WriteFile(targetExe, data, 0755)
}
// Write the application icon
iconDir := filepath.Join(home, ".local", "share", "icons", "hicolor", "512x512", "apps")
os.MkdirAll(iconDir, 0755)
os.WriteFile(filepath.Join(iconDir, "goexplore.png"), icon, 0644)
// Write the desktop shortcut file
appDir := filepath.Join(home, ".local", "share", "applications")
os.MkdirAll(appDir, 0755)
desktopContent := fmt.Sprintf(`[Desktop Entry]
Name=GoExplore
Exec=%s
Icon=goexplore
Type=Application
Terminal=false
Categories=Utility;FileTools;`, targetExe)
os.WriteFile(filepath.Join(appDir, "goexplore.desktop"), []byte(desktopContent), 0644)
// Execute the newly installed binary and exit the current running process
cmd := exec.Command(targetExe)
cmd.Start()
os.Exit(0)
}
func main() {
installLinux()
// Create an instance of the app structure
app := NewApp()