diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 19b7193..9a41096 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -120,8 +120,10 @@ jobs: FYNE_BUILD_FLAGS: "-trimpath -ldflags '-s -w'" run: | fyne package --os android/amd64 --app-id com.oneclickvirt.goecs --app-version "${{ needs.prepare.outputs.app_version }}" --release - if [ -f *.apk ]; then - mv *.apk goecs-gui-android-x86_64-${{ needs.prepare.outputs.version }}.apk + # 查找新生成的 APK(排除已重命名的 arm64 版本) + NEW_APK=$(find . -maxdepth 1 -name "*.apk" -not -name "goecs-gui-android-*" -type f | head -n 1) + if [ -n "$NEW_APK" ]; then + mv "$NEW_APK" goecs-gui-android-x86_64-${{ needs.prepare.outputs.version }}.apk echo "x86_64 APK 构建成功" ls -lh goecs-gui-android-x86_64-${{ needs.prepare.outputs.version }}.apk else @@ -275,12 +277,10 @@ jobs: run: | if [ "${{ runner.os }}" == "macOS" ]; then brew install upx + upx --version elif [ "${{ runner.os }}" == "Windows" ]; then - curl -L https://github.com/upx/upx/releases/download/v4.2.1/upx-4.2.1-win64.zip -o upx.zip - unzip upx.zip - echo "$PWD/upx-4.2.1-win64" >> $GITHUB_PATH + echo "跳过 Windows UPX 安装(不支持)" fi - upx --version - name: Build for ${{ matrix.name }} env: @@ -324,16 +324,17 @@ jobs: - name: Compress with UPX shell: bash run: | + # Windows 跳过 UPX 压缩 + if [ "${{ runner.os }}" == "Windows" ]; then + echo "跳过 Windows exe 的 UPX 压缩(不支持)" + exit 0 + fi + for file in goecs-gui-${{ matrix.name }}-*; do if [ -f "$file" ]; then echo "压缩前大小: $(du -h "$file")" - if [[ "$file" == *.exe ]]; then - # Windows exe 直接压缩 - echo "正在压缩 Windows exe: $file" - upx --best --lzma "$file" || echo "警告: $file 压缩失败" - echo "压缩后大小: $(du -h "$file")" - elif [[ "$file" == *.tar.gz ]]; then + if [[ "$file" == *.tar.gz ]]; then # macOS app 需要解压后压缩二进制 echo "正在处理 macOS app: $file" tar -xzf "$file"