Skip to content

Commit 6cfb383

Browse files
committed
CI: robust macOS artifact handling in release (rebuild .app from Contents if flattened); ensure *.app.zip is produced
1 parent dbd06c0 commit 6cfb383

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,29 @@ jobs:
131131
(
132132
cd artifacts
133133
for dir in IndexRipper-macOS-*; do
134+
[ -d "$dir" ] || continue
135+
zip_name="${dir}.app.zip"
136+
app_src=""
134137
if [ -d "$dir/IndexRipper.app" ]; then
135-
zip_name="${dir}.app.zip"
136-
echo "Zipping $dir/IndexRipper.app -> $zip_name"
137-
zip -r -9 "$zip_name" "$dir/IndexRipper.app"
138+
# 常見情況:artifact 內已有 .app 目錄
139+
app_src="$dir/IndexRipper.app"
140+
elif [ -d "$dir/dist/IndexRipper.app" ]; then
141+
# 另一種情況:保留了 dist 前綴
142+
app_src="$dir/dist/IndexRipper.app"
143+
elif [ -d "$dir/Contents" ]; then
144+
# 展平情況:artifact 只包含 .app 內容,重建包裹
145+
mkdir -p "$dir/_pkg/IndexRipper.app"
146+
shopt -s dotglob
147+
mv "$dir"/* "$dir/_pkg/IndexRipper.app"/
148+
shopt -u dotglob
149+
app_src="$dir/_pkg/IndexRipper.app"
150+
fi
151+
152+
if [ -n "$app_src" ] && [ -d "$app_src" ]; then
153+
echo "Zipping $app_src -> $zip_name"
154+
zip -r -9 "$zip_name" "$app_src"
155+
else
156+
echo "No macOS app bundle found in $dir, skipping"
138157
fi
139158
done
140159
)

0 commit comments

Comments
 (0)