Skip to content

Commit 2fb9091

Browse files
committed
fix:进一步减小打包的体积
1 parent b147798 commit 2fb9091

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ jobs:
101101
env:
102102
ANDROID_NDK_HOME: ${{ env.ANDROID_NDK_HOME }}
103103
GOPRIVATE: github.com/oneclickvirt/security
104+
FYNE_BUILD_FLAGS: "-trimpath -ldflags '-s -w'"
104105
run: |
105106
fyne package --os android --app-id com.oneclickvirt.goecs --app-version "${{ needs.prepare.outputs.app_version }}" --release
106107
if [ -f *.apk ]; then
@@ -117,6 +118,7 @@ jobs:
117118
env:
118119
ANDROID_NDK_HOME: ${{ env.ANDROID_NDK_HOME }}
119120
GOPRIVATE: github.com/oneclickvirt/security
121+
FYNE_BUILD_FLAGS: "-trimpath -ldflags '-s -w'"
120122
run: |
121123
fyne package --os android/amd64 --app-id com.oneclickvirt.goecs --app-version "${{ needs.prepare.outputs.app_version }}" --release
122124
if [ -f *.apk ]; then
@@ -239,15 +241,16 @@ jobs:
239241
- name: Build for ${{ matrix.name }}
240242
env:
241243
GOPRIVATE: github.com/oneclickvirt/security
244+
FYNE_BUILD_FLAGS: "-trimpath -ldflags '-s -w -checklinkname=0'"
242245
shell: bash
243246
run: |
244247
# macOS 需要特殊处理:先编译再打包
245248
if [ "${{ matrix.platform }}" == "darwin" ]; then
246249
echo "Building macOS binary with ldflags..."
247-
go build -ldflags "-checklinkname=0 -s -w" -o goecs-bin .
250+
go build -trimpath -ldflags "-checklinkname=0 -s -w" -o goecs-bin .
248251
249252
echo "Packaging macOS app with fyne..."
250-
fyne package -os darwin -name goecs --exe goecs-bin --app-version "${{ needs.prepare.outputs.app_version }}"
253+
fyne package -os darwin -name goecs --exe goecs-bin --app-version "${{ needs.prepare.outputs.app_version }}" --release
251254
252255
if [ -d goecs.app ]; then
253256
mkdir -p .build
@@ -263,7 +266,7 @@ jobs:
263266
else
264267
# Windows 直接使用 fyne package
265268
echo "Building ${{ matrix.platform }} with fyne package..."
266-
fyne package -os ${{ matrix.platform }} -name goecs --app-version "${{ needs.prepare.outputs.app_version }}"
269+
fyne package -os ${{ matrix.platform }} -name goecs --app-version "${{ needs.prepare.outputs.app_version }}" --release
267270
268271
if [ "${{ matrix.platform }}" == "windows" ]; then
269272
if [ -f goecs.exe ]; then

0 commit comments

Comments
 (0)