From ca6ef6443b72d67b13d42e020e5d602dfa10d193 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A7=E9=98=B3=E6=B7=87=E6=B7=87?= <35864297+hyb-oyqq@users.noreply.github.com> Date: Wed, 17 Dec 2025 23:43:56 +0800 Subject: [PATCH] =?UTF-8?q?ci(build-release):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E6=96=87=E4=BB=B6=E9=AA=8C=E8=AF=81=E6=AD=A5?= =?UTF-8?q?=E9=AA=A4=E5=B9=B6=E4=BF=AE=E5=A4=8D=E5=9B=BE=E6=A0=87=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在构建发布工作流中添加了图标文件存在性验证步骤,确保构建时图标文件存在。 同时修改了 build.spec 文件中的图标路径配置方式,使用相对路径替代原有的绝对路径拼接方式, 以提高配置的可靠性和可维护性。 --- .github/workflows/build-release.yml | 11 +++++++++++ source/build.spec | 6 ++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 9cd5668..e6a6bf4 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -31,6 +31,17 @@ jobs: $version = "${{ github.ref_name }}" echo "VERSION=$version" >> $env:GITHUB_OUTPUT + - name: Verify icon file + run: | + cd source + if (Test-Path "assets/images/ICO/icon.ico") { + Write-Host "Icon file found" + Get-Item "assets/images/ICO/icon.ico" + } else { + Write-Host "Icon file NOT found!" + exit 1 + } + - name: Build with PyInstaller run: | cd source diff --git a/source/build.spec b/source/build.spec index 8cb5704..e96f821 100644 --- a/source/build.spec +++ b/source/build.spec @@ -6,9 +6,7 @@ from PyInstaller.utils.hooks import collect_submodules, collect_data_files block_cipher = None -# 获取spec文件所在目录的绝对路径 -SPEC_ROOT = os.path.dirname(os.path.abspath(SPEC)) -ICON_PATH = os.path.join(SPEC_ROOT, 'assets', 'images', 'ICO', 'icon.ico') + # 收集所有子模块 hiddenimports = [] @@ -71,5 +69,5 @@ exe = EXE( target_arch=None, codesign_identity=None, entitlements_file=None, - icon=ICON_PATH, + icon=os.path.join('assets', 'images', 'ICO', 'icon.ico'), )