diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f9f53c1..8e2ce18 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,8 +31,11 @@ jobs: run: | python -m pip install --upgrade pip pip install pyinstaller pathspec pyperclip - if [ "${{ matrix.os }}" != "windows-latest" ]; then + + if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then sudo apt-get update && sudo apt-get install -y upx + elif [ "${{ matrix.os }}" = "macos-latest" ]; then + brew install upx fi # Build binary with PyInstaller and optimize @@ -42,7 +45,16 @@ jobs: if [ "${{ matrix.os }}" = "windows-latest" ]; then pyinstaller --onefile --noconsole --name gptree.exe cli_tool_gptree/main.py else - pyinstaller --onefile --noconsole --upx-dir=/usr/bin --name gptree cli_tool_gptree/main.py + # Dynamically find UPX path + UPX_PATH=$(which upx || echo "") + echo "Using UPX path: $UPX_PATH" + + if [ -n "$UPX_PATH" ]; then + pyinstaller --onefile --noconsole --upx-dir=$(dirname "$UPX_PATH") --name gptree cli_tool_gptree/main.py + else + echo "UPX not found; skipping compression." + pyinstaller --onefile --noconsole --name gptree cli_tool_gptree/main.py + fi fi # Rename binaries for platform-specific names