Skip to content

Commit 0d84ae5

Browse files
authored
Update build.yml
1 parent b8fc3e5 commit 0d84ae5

1 file changed

Lines changed: 46 additions & 9 deletions

File tree

.github/workflows/build.yml

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,33 +151,63 @@ jobs:
151151
fi
152152
shell: bash
153153

154+
- name: Generate application icon
155+
if: startsWith(github.ref, 'refs/tags/') && matrix.enable_gui == true
156+
run: |
157+
python3 generate_icon.py
158+
ls -lh app_icon.* 2>/dev/null || echo "Icon files generated"
159+
shell: bash
160+
154161
- name: Build Python executable
155162
if: startsWith(github.ref, 'refs/tags/') && matrix.enable_gui == true
156163
run: |
164+
# 构建 PyInstaller 命令,根据平台添加图标
165+
ICON_ARG=""
157166
if [ "${{ matrix.goos }}" == "windows" ]; then
158-
pyinstaller --onefile --windowed --name ECHWorkersGUI --hidden-import=PyQt5 gui.py
167+
if [ -f "app_icon.ico" ]; then
168+
ICON_ARG="--icon=app_icon.ico"
169+
elif [ -f "app_icon.png" ]; then
170+
ICON_ARG="--icon=app_icon.png"
171+
fi
172+
pyinstaller --onefile --windowed --name ECHWorkersGUI --hidden-import=PyQt5 $ICON_ARG gui.py
159173
elif [ "${{ matrix.goos }}" == "linux" ]; then
160174
if python -c "import PyQt5.QtWidgets" 2>/dev/null; then
161-
pyinstaller --onefile --name ECHWorkersGUI --hidden-import=PyQt5 gui.py
175+
if [ -f "app_icon.png" ]; then
176+
ICON_ARG="--icon=app_icon.png"
177+
fi
178+
pyinstaller --onefile --name ECHWorkersGUI --hidden-import=PyQt5 $ICON_ARG gui.py
162179
else
163180
echo "PyQt5 not available, skipping GUI build for Linux"
164181
echo "Only Go executable will be included"
165182
fi
166183
else
167-
pyinstaller --onefile --name ECHWorkersGUI --hidden-import=PyQt5 gui.py
184+
# macOS
185+
if [ -f "app_icon.icns" ]; then
186+
ICON_ARG="--icon=app_icon.icns"
187+
elif [ -f "app_icon.png" ]; then
188+
ICON_ARG="--icon=app_icon.png"
189+
fi
190+
pyinstaller --onefile --name ECHWorkersGUI --hidden-import=PyQt5 $ICON_ARG gui.py
168191
fi
169192
shell: bash
170193

171194
- name: Download China IP list
172195
if: startsWith(github.ref, 'refs/tags/')
173196
run: |
174-
echo "Downloading latest China IP list..."
175-
curl -L -o chn_ip.txt "https://raw.githubusercontent.com/mayaxcn/china-ip-list/refs/heads/master/chn_ip.txt" || echo "Failed to download, will skip"
197+
echo "Downloading latest China IP list (IPv4 and IPv6)..."
198+
curl -L -o chn_ip.txt "https://raw.githubusercontent.com/mayaxcn/china-ip-list/refs/heads/master/chn_ip.txt" || echo "Failed to download IPv4 list, will skip"
199+
curl -L -o chn_ip_v6.txt "https://raw.githubusercontent.com/mayaxcn/china-ip-list/refs/heads/master/chn_ip_v6.txt" || echo "Failed to download IPv6 list, will skip"
176200
if [ -f "chn_ip.txt" ]; then
177-
echo "✓ China IP list downloaded successfully"
201+
echo "✓ China IPv4 IP list downloaded successfully"
178202
wc -l chn_ip.txt
179203
else
180-
echo "⚠ China IP list download failed, release will continue without it"
204+
echo "⚠ China IPv4 IP list download failed, release will continue without it"
205+
fi
206+
if [ -f "chn_ip_v6.txt" ]; then
207+
echo "✓ China IPv6 IP list downloaded successfully"
208+
wc -l chn_ip_v6.txt
209+
else
210+
echo "⚠ China IPv6 IP list download failed, release will continue without it"
181211
fi
182212
shell: bash
183213

@@ -192,7 +222,11 @@ jobs:
192222
# 中国IP列表文件(离线版本)
193223
if [ -f "chn_ip.txt" ]; then
194224
cp chn_ip.txt release/
195-
echo "✓ China IP list included in release"
225+
echo "✓ China IPv4 IP list included in release"
226+
fi
227+
if [ -f "chn_ip_v6.txt" ]; then
228+
cp chn_ip_v6.txt release/
229+
echo "✓ China IPv6 IP list included in release"
196230
fi
197231
198232
# GUI(仅桌面版)
@@ -220,7 +254,10 @@ jobs:
220254
echo "Files:"
221255
echo "- ech-workers${{ matrix.exe_ext }}: Go compiled core proxy program"
222256
if [ -f "release/chn_ip.txt" ]; then
223-
echo "- chn_ip.txt: China IP list (offline version)"
257+
echo "- chn_ip.txt: China IPv4 IP list (offline version)"
258+
fi
259+
if [ -f "release/chn_ip_v6.txt" ]; then
260+
echo "- chn_ip_v6.txt: China IPv6 IP list (offline version)"
224261
fi
225262
if [ "${{ matrix.enable_gui }}" = "true" ]; then
226263
if [ "${{ matrix.goos }}" == "windows" ]; then

0 commit comments

Comments
 (0)