Skip to content

Commit be1c2fe

Browse files
authored
Update build.yml
1 parent 7607ecb commit be1c2fe

1 file changed

Lines changed: 43 additions & 22 deletions

File tree

.github/workflows/build.yml

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,28 @@ jobs:
5959
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o ech-workers${{ matrix.exe_ext }} ech-workers.go
6060
shell: bash
6161

62+
- name: Set up Python
63+
if: startsWith(github.ref, 'refs/tags/')
64+
uses: actions/setup-python@v5
65+
with:
66+
python-version: '3.11'
67+
68+
- name: Install PyInstaller and dependencies
69+
if: startsWith(github.ref, 'refs/tags/')
70+
run: |
71+
python -m pip install --upgrade pip
72+
pip install pyinstaller PyQt5 pystray Pillow
73+
74+
- name: Build Python executable
75+
if: startsWith(github.ref, 'refs/tags/')
76+
run: |
77+
if [ "${{ matrix.goos }}" == "windows" ]; then
78+
pyinstaller --onefile --windowed --name ECHWorkersGUI gui.py
79+
else
80+
pyinstaller --onefile --windowed --name ECHWorkersGUI gui.py
81+
fi
82+
shell: bash
83+
6284
- name: Prepare release files
6385
if: startsWith(github.ref, 'refs/tags/')
6486
run: |
@@ -67,22 +89,16 @@ jobs:
6789
# 复制 Go 可执行文件
6890
cp ech-workers${{ matrix.exe_ext }} release/
6991
70-
# 复制 Python 文件
71-
cp gui.py release/
72-
cp requirements.txt release/
73-
74-
# 创建运行脚本
92+
# 复制 Python 打包后的可执行文件
7593
if [ "${{ matrix.goos }}" == "windows" ]; then
76-
echo "@echo off" > release/run.bat
77-
echo "python gui.py" >> release/run.bat
78-
echo "if errorlevel 1 (" >> release/run.bat
79-
echo " echo Please install PyQt5: pip install PyQt5" >> release/run.bat
80-
echo " pause" >> release/run.bat
81-
echo ")" >> release/run.bat
94+
if [ -f "dist/ECHWorkersGUI.exe" ]; then
95+
cp dist/ECHWorkersGUI.exe release/
96+
fi
8297
else
83-
echo "#!/bin/bash" > release/run.sh
84-
echo "python3 gui.py" >> release/run.sh
85-
chmod +x release/run.sh
98+
if [ -f "dist/ECHWorkersGUI" ]; then
99+
cp dist/ECHWorkersGUI release/
100+
chmod +x release/ECHWorkersGUI
101+
fi
86102
fi
87103
88104
# 创建 README
@@ -91,20 +107,25 @@ jobs:
91107
echo ""
92108
echo "Files:"
93109
echo "- ech-workers(.exe): Go compiled core proxy program"
94-
echo "- gui.py: Python GUI client"
95-
echo "- requirements.txt: Python dependencies"
96-
echo "- run.sh / run.bat: Launch script"
110+
if [ "${{ matrix.goos }}" == "windows" ]; then
111+
echo "- ECHWorkersGUI.exe: Python GUI client (standalone executable)"
112+
else
113+
echo "- ECHWorkersGUI: Python GUI client (standalone executable)"
114+
fi
97115
echo ""
98116
echo "Usage:"
99-
echo "1. Install Python 3.6+ (if not already installed)"
100-
echo "2. Install dependencies: pip install PyQt5"
101-
echo "3. Run: python gui.py"
102-
echo " Or use launch script: ./run.sh (Mac) or run.bat (Windows)"
117+
if [ "${{ matrix.goos }}" == "windows" ]; then
118+
echo "1. Double-click ECHWorkersGUI.exe to launch the GUI"
119+
echo "2. Or run ech-workers.exe from command line"
120+
else
121+
echo "1. Run ./ECHWorkersGUI to launch the GUI"
122+
echo "2. Or run ./ech-workers from command line"
123+
fi
103124
echo ""
104125
echo "System Requirements:"
105126
echo "- Windows: Windows 10+"
106127
echo "- macOS: macOS 10.13+"
107-
echo "- Python: 3.6+"
128+
echo "- No Python installation required (standalone executables)"
108129
} > release/README.txt
109130
shell: bash
110131

0 commit comments

Comments
 (0)