@@ -106,7 +106,24 @@ jobs:
106106 dir .env
107107 dir assets
108108 # 构建
109- pyinstaller --noconsole --add-data ".env;." --add-data "assets/*;assets" --icon "assets/icon.ico" --name "Text2Voice" main.py
109+ pyinstaller --noconsole \
110+ --add-data ".env;." \
111+ --add-data "assets/*;assets" \
112+ --icon "assets/icon.ico" \
113+ --name "Text2Voice" \
114+ --hidden-import PyQt6.QtCore \
115+ --hidden-import PyQt6.QtGui \
116+ --hidden-import PyQt6.QtWidgets \
117+ --exclude-module matplotlib \
118+ --exclude-module numpy \
119+ --exclude-module PIL \
120+ --exclude-module pandas \
121+ --exclude-module scipy \
122+ --exclude-module tkinter \
123+ --exclude-module PyQt6.QtSvg \
124+ --exclude-module PyQt6.QtNetwork \
125+ --exclude-module PyQt6.QtPrintSupport \
126+ main.py
110127
111128 - name : Install macOS dependencies
112129 if : runner.os == 'macOS'
@@ -141,47 +158,53 @@ jobs:
141158 ls -la .env
142159 ls -la assets
143160
144- # Intel Mac 构建
145- echo "Building for Intel Mac..."
146- ARCH="x86_64" pyinstaller --noconsole \
161+ # 只构建当前平台架构
162+ pyinstaller --noconsole \
147163 --add-data ".env:." \
148164 --add-data "assets/*:assets" \
149165 --icon "assets/icon.icns" \
150- --name "Text2Voice-Intel" \
151- --add-binary "${INTEL_QT_PATH}/lib:Qt6" \
152- --add-binary "${INTEL_QT_PATH}/plugins:Qt6/plugins" \
166+ --name "Text2Voice" \
153167 --hidden-import PyQt6.QtCore \
154168 --hidden-import PyQt6.QtGui \
155169 --hidden-import PyQt6.QtWidgets \
156- --collect-all PyQt6 \
170+ --exclude-module matplotlib \
171+ --exclude-module numpy \
172+ --exclude-module PIL \
173+ --exclude-module pandas \
174+ --exclude-module scipy \
175+ --exclude-module tkinter \
176+ --exclude-module PyQt6.QtSvg \
177+ --exclude-module PyQt6.QtNetwork \
178+ --exclude-module PyQt6.QtPrintSupport \
157179 main.py
158-
159- # Apple Silicon Mac 构建
160- echo "Building for Apple Silicon Mac..."
161- ARCH="arm64" pyinstaller --noconsole \
180+
181+ - name : Build (Linux)
182+ if : runner.os == 'Linux'
183+ run : |
184+ # 确保文件存在
185+ echo "Checking files..."
186+ ls -la .env
187+ ls -la assets
188+ # 构建
189+ pyinstaller --noconsole \
162190 --add-data ".env:." \
163191 --add-data "assets/*:assets" \
164- --icon "assets/icon.icns" \
165- --name "Text2Voice-ARM" \
166- --add-binary "${ARM_QT_PATH}/lib:Qt6" \
167- --add-binary "${ARM_QT_PATH}/plugins:Qt6/plugins" \
192+ --icon "assets/icon.png" \
193+ --name "Text2Voice" \
168194 --hidden-import PyQt6.QtCore \
169195 --hidden-import PyQt6.QtGui \
170196 --hidden-import PyQt6.QtWidgets \
171- --collect-all PyQt6 \
197+ --exclude-module matplotlib \
198+ --exclude-module numpy \
199+ --exclude-module PIL \
200+ --exclude-module pandas \
201+ --exclude-module scipy \
202+ --exclude-module tkinter \
203+ --exclude-module PyQt6.QtSvg \
204+ --exclude-module PyQt6.QtNetwork \
205+ --exclude-module PyQt6.QtPrintSupport \
172206 main.py
173-
174- # 创建通用二进制(Universal Binary)
175- echo "Creating Universal Binary..."
176- mkdir -p "dist/Text2Voice.app/Contents/MacOS"
177- lipo "dist/Text2Voice-Intel.app/Contents/MacOS/Text2Voice-Intel" \
178- "dist/Text2Voice-ARM.app/Contents/MacOS/Text2Voice-ARM" \
179- -create -output "dist/Text2Voice.app/Contents/MacOS/Text2Voice"
180-
181- # 复制资源文件
182- cp -R "dist/Text2Voice-Intel.app/Contents/Resources" "dist/Text2Voice.app/Contents/"
183- cp -R "dist/Text2Voice-Intel.app/Contents/Info.plist" "dist/Text2Voice.app/Contents/"
184-
207+
185208 - name : Create DMG (macOS)
186209 if : runner.os == 'macOS'
187210 run : |
0 commit comments