Skip to content

Commit ac1db60

Browse files
committed
ci: search both target dirs for macOS bundles
1 parent eef1964 commit ac1db60

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

.github/workflows/build.yml

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ jobs:
148148
Remove-Item -Recurse -Force rustfs-temp, rustfs-windows-x86_64.zip
149149
150150
- name: Build Tauri application
151-
run: cargo tauri build --target ${{ matrix.rust_target }}
151+
run: cargo tauri build --target ${{ matrix.rust_target }} --target-dir target
152152

153153
- name: Prepare and rename artifacts (macOS)
154154
if: runner.os == 'macOS'
@@ -163,19 +163,35 @@ jobs:
163163
# Format: rustfs-launcher-{os}-{arch}-{version}
164164
ARTIFACT_PREFIX="rustfs-launcher-${{ matrix.os_name }}-${{ matrix.arch }}-${VERSION}"
165165
166-
# 构建产物目录(兼容默认路径和显式 target 路径)
167-
DMG_DIR="src-tauri/target/${{ matrix.rust_target }}/release/bundle/dmg"
168-
BUNDLE_DIR="src-tauri/target/${{ matrix.rust_target }}/release/bundle/macos"
169-
if [ ! -d "$DMG_DIR" ]; then
170-
DMG_DIR="src-tauri/target/release/bundle/dmg"
171-
fi
172-
if [ ! -d "$BUNDLE_DIR" ]; then
173-
BUNDLE_DIR="src-tauri/target/release/bundle/macos"
174-
fi
166+
# 构建产物目录(兼容 src-tauri/target 与 workspace target)
167+
DMG_DIR=""
168+
BUNDLE_DIR=""
169+
DMG_CANDIDATES=(
170+
"src-tauri/target/${{ matrix.rust_target }}/release/bundle/dmg"
171+
"target/${{ matrix.rust_target }}/release/bundle/dmg"
172+
"src-tauri/target/release/bundle/dmg"
173+
"target/release/bundle/dmg"
174+
)
175+
BUNDLE_CANDIDATES=(
176+
"src-tauri/target/${{ matrix.rust_target }}/release/bundle/macos"
177+
"target/${{ matrix.rust_target }}/release/bundle/macos"
178+
"src-tauri/target/release/bundle/macos"
179+
"target/release/bundle/macos"
180+
)
181+
182+
for d in "${DMG_CANDIDATES[@]}"; do
183+
if [ -d "$d" ]; then DMG_DIR="$d"; break; fi
184+
done
185+
for d in "${BUNDLE_CANDIDATES[@]}"; do
186+
if [ -d "$d" ]; then BUNDLE_DIR="$d"; break; fi
187+
done
175188
176-
if [ ! -d "$DMG_DIR" ] && [ ! -d "$BUNDLE_DIR" ]; then
177-
echo "❌ 未找到打包输出目录:$DMG_DIR 或 $BUNDLE_DIR"
178-
ls -la src-tauri/target || true
189+
if [ -z "$DMG_DIR" ] && [ -z "$BUNDLE_DIR" ]; then
190+
echo "❌ 未找到打包输出目录,尝试过:"
191+
printf ' - %s\n' "${DMG_CANDIDATES[@]}" "${BUNDLE_CANDIDATES[@]}"
192+
echo "目录列表:"
193+
ls -la src-tauri || true
194+
ls -la target || true
179195
exit 1
180196
fi
181197

0 commit comments

Comments
 (0)