Skip to content

Commit 1c31e25

Browse files
authored
Update build.yml
1 parent d6ecae9 commit 1c31e25

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,21 @@ jobs:
7777
if [ "${{ matrix.goos }}" == "windows" ]; then
7878
pyinstaller --onefile --windowed --name ECHWorkersGUI gui.py
7979
else
80-
pyinstaller --onefile --windowed --name ECHWorkersGUI gui.py
80+
# macOS: 根据目标架构设置环境变量
81+
if [ "${{ matrix.goarch }}" == "arm64" ]; then
82+
# Apple Silicon: 确保使用 arm64 Python
83+
export ARCHFLAGS="-arch arm64"
84+
pyinstaller --onefile --windowed --name ECHWorkersGUI gui.py
85+
else
86+
# Intel: 使用 x86_64 架构(可能需要 Rosetta)
87+
export ARCHFLAGS="-arch x86_64"
88+
# 在 Apple Silicon runner 上,使用 Rosetta 运行
89+
if [ "$(uname -m)" == "arm64" ]; then
90+
arch -x86_64 pyinstaller --onefile --windowed --name ECHWorkersGUI gui.py || pyinstaller --onefile --windowed --name ECHWorkersGUI gui.py
91+
else
92+
pyinstaller --onefile --windowed --name ECHWorkersGUI gui.py
93+
fi
94+
fi
8195
fi
8296
shell: bash
8397

0 commit comments

Comments
 (0)