diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index c618a1ff..07adde6a 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -80,11 +80,11 @@ jobs: name: nexa-cli_windows_${{ matrix.arch }} path: artifacts - - - name: Build launcher with PyInstaller + - name: Build launcher run: | - pip install pyinstaller - pyinstaller --onefile --noconsole --distpath artifacts --name "nexa-cli-launcher" --icon="runner/release/windows/nexa_logo.ico" runner/release/windows/nexa_launcher.py + cd runner/release/windows + windres resource.rc launcher.syso + go build -ldflags "-H windowsgui" -o ../../../artifacts/nexa-cli-launcher.exe - name: Sign executables with AzureSignTool shell: pwsh diff --git a/runner/release/windows/launcher.go b/runner/release/windows/launcher.go new file mode 100644 index 00000000..02234428 --- /dev/null +++ b/runner/release/windows/launcher.go @@ -0,0 +1,14 @@ +//go:build windows + +package main + +import ( + "os/exec" + "syscall" +) + +func main() { + cmd := exec.Command("cmd", "/c", "start", "powershell", "-NoProfile", "-NoExit", "-Command", "nexa") + cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true} + _ = cmd.Start() +} diff --git a/runner/release/windows/nexa_launcher.py b/runner/release/windows/nexa_launcher.py deleted file mode 100644 index ffc44690..00000000 --- a/runner/release/windows/nexa_launcher.py +++ /dev/null @@ -1,9 +0,0 @@ -import subprocess - -# Launch PowerShell with the -NoProfile flag which is generally faster to start -# Use -NoExit to keep PowerShell open after running the command -# Use -Command to specify the command to run -subprocess.Popen( - ["powershell", "-NoProfile", "-NoExit", "-Command", "nexa"], - creationflags=subprocess.CREATE_NEW_CONSOLE -) \ No newline at end of file diff --git a/runner/release/windows/resource.rc b/runner/release/windows/resource.rc new file mode 100644 index 00000000..3e489641 --- /dev/null +++ b/runner/release/windows/resource.rc @@ -0,0 +1 @@ +1 ICON "nexa_logo.ico" \ No newline at end of file