From 25f2a10ce8bc79e71eec2ee37949848115cfe504 Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Fri, 31 Oct 2025 18:05:06 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8Dfyne=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 48 +++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7a29b4b..d3bc36e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -243,32 +243,34 @@ jobs: run: | mkdir -p .build - # Use go build instead of fyne package for better compatibility + # Build the package with ldflags + fyne package -os ${{ matrix.platform }} -name goecs --app-version "${{ needs.prepare.outputs.app_version }}" -ldflags "-checklinkname=0 -s -w" + + # Package the output if [ "${{ matrix.platform }}" == "darwin" ]; then - go build -ldflags="-checklinkname=0 -s -w" -o goecs . - mkdir -p goecs.app/Contents/MacOS - mkdir -p goecs.app/Contents/Resources - mv goecs goecs.app/Contents/MacOS/ - echo '' > goecs.app/Contents/Info.plist - echo '' >> goecs.app/Contents/Info.plist - echo '' >> goecs.app/Contents/Info.plist - echo 'CFBundleExecutablegoecs' >> goecs.app/Contents/Info.plist - echo 'CFBundleIdentifiercom.oneclickvirt.goecs' >> goecs.app/Contents/Info.plist - echo 'CFBundleNamegoecs' >> goecs.app/Contents/Info.plist - echo 'CFBundlePackageTypeAPPL' >> goecs.app/Contents/Info.plist - echo 'CFBundleShortVersionString${{ needs.prepare.outputs.app_version }}' >> goecs.app/Contents/Info.plist - echo 'LSMinimumSystemVersion10.13.0' >> goecs.app/Contents/Info.plist - echo '' >> goecs.app/Contents/Info.plist - tar -czf .build/goecs-${{ matrix.name }}-${{ needs.prepare.outputs.version }}.tar.gz goecs.app - echo "macOS app 构建成功" + if [ -d goecs.app ]; then + tar -czf .build/goecs-${{ matrix.name }}-${{ needs.prepare.outputs.version }}.tar.gz goecs.app + echo "macOS app 构建成功" + else + echo "macOS app 构建失败" + exit 1 + fi elif [ "${{ matrix.platform }}" == "windows" ]; then - go build -ldflags="-checklinkname=0 -s -w -H=windowsgui" -o goecs.exe . - mv goecs.exe .build/goecs-${{ matrix.name }}-${{ needs.prepare.outputs.version }}.exe - echo "Windows exe 构建成功" + if [ -f goecs.exe ]; then + mv goecs.exe .build/goecs-${{ matrix.name }}-${{ needs.prepare.outputs.version }}.exe + echo "Windows exe 构建成功" + else + echo "Windows exe 构建失败" + exit 1 + fi elif [ "${{ matrix.platform }}" == "linux" ]; then - go build -ldflags="-checklinkname=0 -s -w" -o goecs . - tar -czf .build/goecs-${{ matrix.name }}-${{ needs.prepare.outputs.version }}.tar.gz goecs - echo "Linux binary 构建成功" + if [ -f goecs ]; then + tar -czf .build/goecs-${{ matrix.name }}-${{ needs.prepare.outputs.version }}.tar.gz goecs + echo "Linux binary 构建成功" + else + echo "Linux binary 构建失败" + exit 1 + fi fi - name: List build artifacts