Skip to content

Commit ae6dcff

Browse files
committed
fix: 修复路径选择问题
1 parent 2bc0eb9 commit ae6dcff

File tree

1 file changed

+15
-23
lines changed

1 file changed

+15
-23
lines changed

.github/workflows/build.yml

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -380,17 +380,16 @@ jobs:
380380
go build -trimpath -ldflags "-checklinkname=0 -s -w" -o "$BUILD_DIR/ecs-gui-bin" .
381381
382382
echo "Packaging macOS app with fyne..."
383-
cd "$BUILD_DIR"
384-
fyne package -os darwin -name ecs-gui --exe ecs-gui-bin --app-version "${{ needs.prepare.outputs.app_version }}" --release
385-
cd ..
383+
# 在根目录运行 fyne package,指定编译好的二进制文件路径
384+
fyne package -os darwin -name ecs-gui --exe "$BUILD_DIR/ecs-gui-bin" --app-version "${{ needs.prepare.outputs.app_version }}" --release
386385
387-
if [ -d "$BUILD_DIR/ecs-gui.app" ]; then
386+
if [ -d "ecs-gui.app" ]; then
388387
TARFILE="ecs-gui-${{ matrix.name }}-${{ needs.prepare.outputs.version }}.tar.gz"
389388
echo "Creating tar file: $TARFILE"
390-
tar -czf "$TARFILE" -C "$BUILD_DIR" ecs-gui.app
389+
tar -czf "$TARFILE" ecs-gui.app
391390
echo "✓ macOS app 构建成功"
392-
# 清理构建目录
393-
rm -rf "$BUILD_DIR"
391+
# 清理构建目录和生成的 app
392+
rm -rf "$BUILD_DIR" ecs-gui.app
394393
else
395394
echo "✗ macOS app 构建失败"
396395
exit 1
@@ -412,37 +411,30 @@ jobs:
412411
fi
413412
414413
echo "Packaging Linux app with fyne..."
415-
cd "$BUILD_DIR"
416-
fyne package -os linux -name ecs-gui --exe ecs-gui --app-version "${{ needs.prepare.outputs.app_version }}" --release
417-
cd ..
414+
# 在根目录运行 fyne package,指定编译好的二进制文件路径
415+
fyne package -os linux -name ecs-gui --exe "$BUILD_DIR/ecs-gui" --app-version "${{ needs.prepare.outputs.app_version }}" --release
418416
419417
# 查找生成的 tar.xz 文件
420-
if [ -f "$BUILD_DIR/ecs-gui.tar.xz" ]; then
421-
mv "$BUILD_DIR/ecs-gui.tar.xz" ecs-gui-${{ matrix.name }}-${{ needs.prepare.outputs.version }}.tar.xz
418+
if [ -f "ecs-gui.tar.xz" ]; then
419+
mv "ecs-gui.tar.xz" ecs-gui-${{ matrix.name }}-${{ needs.prepare.outputs.version }}.tar.xz
422420
echo "✓ Linux tar.xz 构建成功"
423421
# 清理构建目录
424422
rm -rf "$BUILD_DIR"
425423
else
426424
echo "✗ Linux tar.xz 构建失败"
427-
ls -la "$BUILD_DIR/"
425+
ls -la .
428426
exit 1
429427
fi
430428
else
431-
# Windows 构建 - 使用独立目录
432-
BUILD_DIR="build-${{ matrix.name }}"
433-
mkdir -p "$BUILD_DIR"
434-
429+
# Windows 构建
435430
echo "Building ${{ matrix.platform }} with fyne package..."
436-
cd "$BUILD_DIR"
431+
# 在根目录运行 fyne package
437432
fyne package -os ${{ matrix.platform }} -name ecs-gui --app-version "${{ needs.prepare.outputs.app_version }}" --release
438-
cd ..
439433
440434
if [ "${{ matrix.platform }}" == "windows" ]; then
441-
if [ -f "$BUILD_DIR/ecs-gui.exe" ]; then
442-
mv "$BUILD_DIR/ecs-gui.exe" ecs-gui-${{ matrix.name }}-${{ needs.prepare.outputs.version }}.exe
435+
if [ -f "ecs-gui.exe" ]; then
436+
mv "ecs-gui.exe" ecs-gui-${{ matrix.name }}-${{ needs.prepare.outputs.version }}.exe
443437
echo "✓ Windows exe 构建成功"
444-
# 清理构建目录
445-
rm -rf "$BUILD_DIR"
446438
else
447439
echo "✗ Windows exe 构建失败"
448440
exit 1

0 commit comments

Comments
 (0)