Skip to content

Commit 1de4884

Browse files
committed
ci: simplify macOS artifact discovery
1 parent 8e36612 commit 1de4884

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -164,23 +164,22 @@ jobs:
164164
ARTIFACT_PREFIX="rustfs-launcher-${{ matrix.os_name }}-${{ matrix.arch }}-${VERSION}"
165165
166166
# 在 workspace 内搜索打包输出,不依赖固定路径
167-
mapfile -t APP_DIRS < <(find src-tauri target -path "*bundle/macos/*.app" -type d 2>/dev/null || true)
168-
mapfile -t DMG_FILES < <(find src-tauri target -path "*bundle/dmg/*.dmg" -type f 2>/dev/null || true)
167+
APP_DIR=$(find src-tauri target -path "*bundle/macos/*.app" -type d -print -quit 2>/dev/null || true)
168+
DMG_FILE=$(find src-tauri target -path "*bundle/dmg/*.dmg" -type f -print -quit 2>/dev/null || true)
169169
170-
echo "发现的 .app 目录:" && printf ' - %s\n' "${APP_DIRS[@]:-无}"
171-
echo "发现的 .dmg 文件:" && printf ' - %s\n' "${DMG_FILES[@]:-无}"
170+
echo "发现的 .app 目录:${APP_DIR:-无}"
171+
echo "发现的 .dmg 文件:${DMG_FILE:-无}"
172172
173173
# Copy and rename DMG
174-
if [ ${#DMG_FILES[@]} -gt 0 ]; then
175-
cp "${DMG_FILES[0]}" "artifacts/${ARTIFACT_PREFIX}.dmg"
174+
if [ -n "$DMG_FILE" ]; then
175+
cp "$DMG_FILE" "artifacts/${ARTIFACT_PREFIX}.dmg"
176176
echo "✅ Created: ${ARTIFACT_PREFIX}.dmg"
177177
fi
178178
179179
# Create and rename app.zip
180-
if [ ${#APP_DIRS[@]} -gt 0 ]; then
181-
FIRST_APP="${APP_DIRS[0]}"
182-
APP_PARENT="$(dirname "$FIRST_APP")"
183-
APP_NAME="$(basename "$FIRST_APP")"
180+
if [ -n "$APP_DIR" ]; then
181+
APP_PARENT="$(dirname "$APP_DIR")"
182+
APP_NAME="$(basename "$APP_DIR")"
184183
cd "$APP_PARENT"
185184
zip -r "$GITHUB_WORKSPACE/artifacts/${ARTIFACT_PREFIX}.app.zip" "$APP_NAME"
186185
echo "✅ Created: ${ARTIFACT_PREFIX}.app.zip"

0 commit comments

Comments
 (0)