Improve macOS build artifact detection and packaging
Enhanced the workflow to robustly locate .app and .dmg files in both dist/ and build/ directories, ensuring screenshots are removed from the .app bundle before packaging. Added directory listings for debugging and improved artifact naming and copying logic for more reliable release preparation.
This commit is contained in:
@@ -153,19 +153,30 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
source venv/bin/activate
|
source venv/bin/activate
|
||||||
python setup_cxfreeze.py bdist_mac
|
python setup_cxfreeze.py bdist_mac
|
||||||
|
# Locate the built .app (cx_Freeze may place it under build/ or dist/)
|
||||||
app_name="YTSage-v${VERSION}.app"
|
app_path=""
|
||||||
app_path="dist/${app_name}"
|
for cand in "dist/YTSage-v${VERSION}.app" "build/dist/YTSage-v${VERSION}.app" "build/YTSage-v${VERSION}.app"; do
|
||||||
if [ -d "$app_path/Contents/Resources/assets/branding/screenshots" ]; then
|
if [ -d "$cand" ]; then app_path="$cand"; break; fi
|
||||||
rm -rf "$app_path/Contents/Resources/assets/branding/screenshots"
|
done
|
||||||
echo "Removed screenshots folder from .app bundle"
|
if [ -z "$app_path" ]; then
|
||||||
|
app_path=$(ls -d dist/*.app build/dist/*.app build/*.app 2>/dev/null | head -n1 || true)
|
||||||
fi
|
fi
|
||||||
|
if [ -n "$app_path" ] && [ -d "$app_path/Contents/Resources/assets/branding/screenshots" ]; then
|
||||||
|
rm -rf "$app_path/Contents/Resources/assets/branding/screenshots"
|
||||||
|
echo "Removed screenshots folder from .app bundle at $app_path"
|
||||||
|
fi
|
||||||
|
echo "Post-bdist_mac directory listing:"
|
||||||
|
echo "-- dist --"; ls -lah dist || true
|
||||||
|
echo "-- build --"; ls -lah build || true
|
||||||
|
|
||||||
- name: Build DMG (bdist_dmg)
|
- name: Build DMG (bdist_dmg)
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
source venv/bin/activate
|
source venv/bin/activate
|
||||||
python setup_cxfreeze.py bdist_dmg
|
python setup_cxfreeze.py bdist_dmg
|
||||||
|
echo "Post-bdist_dmg directory listing:"
|
||||||
|
echo "-- dist --"; ls -lah dist || true
|
||||||
|
echo "-- build --"; ls -lah build || true
|
||||||
|
|
||||||
- name: Package and prepare release artifacts (.app.zip and .dmg)
|
- name: Package and prepare release artifacts (.app.zip and .dmg)
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -174,29 +185,43 @@ jobs:
|
|||||||
echo "Preparing artifacts for version: $version"
|
echo "Preparing artifacts for version: $version"
|
||||||
mkdir -p artifacts
|
mkdir -p artifacts
|
||||||
|
|
||||||
app_name="YTSage-v${version}.app"
|
# Find the .app bundle (preferring versioned name)
|
||||||
app_path="dist/${app_name}"
|
app_path=""
|
||||||
if [ -d "$app_path" ]; then
|
for cand in "dist/YTSage-v${version}.app" "build/dist/YTSage-v${version}.app" "build/YTSage-v${version}.app"; do
|
||||||
(cd dist && zip -r "../artifacts/YTSage-v${version}.app.zip" "$app_name")
|
if [ -d "$cand" ]; then app_path="$cand"; break; fi
|
||||||
echo "Created: $(pwd)/artifacts/YTSage-v${version}.app.zip"
|
done
|
||||||
|
if [ -z "$app_path" ]; then
|
||||||
|
app_path=$(ls -d dist/*.app build/dist/*.app build/*.app 2>/dev/null | head -n1 || true)
|
||||||
|
fi
|
||||||
|
if [ -n "$app_path" ] && [ -d "$app_path" ]; then
|
||||||
|
app_base="$(basename "$app_path")"
|
||||||
|
app_parent="$(dirname "$app_path")"
|
||||||
|
# Ensure screenshots folder is not shipped
|
||||||
|
if [ -d "$app_path/Contents/Resources/assets/branding/screenshots" ]; then
|
||||||
|
rm -rf "$app_path/Contents/Resources/assets/branding/screenshots"
|
||||||
|
echo "Removed screenshots folder from .app bundle at $app_path"
|
||||||
|
fi
|
||||||
|
(cd "$app_parent" && zip -r "${GITHUB_WORKSPACE}/artifacts/${app_base}.zip" "$app_base")
|
||||||
|
echo "Created: artifacts/${app_base}.zip"
|
||||||
else
|
else
|
||||||
echo "Warning: .app bundle not found at $app_path"
|
echo "Warning: .app bundle not found in dist/ or build/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Try to find the generated DMG in dist
|
# Try to find the generated DMG in dist or build
|
||||||
dmg_src=""
|
dmg_src=""
|
||||||
if [ -f "dist/YTSage-v${version}.dmg" ]; then
|
for cand in "dist/YTSage-v${version}.dmg"; do
|
||||||
dmg_src="dist/YTSage-v${version}.dmg"
|
if [ -f "$cand" ]; then dmg_src="$cand"; break; fi
|
||||||
else
|
done
|
||||||
# Fallback: pick first .dmg in dist
|
if [ -z "$dmg_src" ]; then
|
||||||
dmg_src=$(ls dist/*.dmg 2>/dev/null | head -n 1 || true)
|
dmg_src=$(ls dist/*.dmg build/*.dmg build/dist/*.dmg 2>/dev/null | head -n1 || true)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$dmg_src" ] && [ -f "$dmg_src" ]; then
|
if [ -n "$dmg_src" ] && [ -f "$dmg_src" ]; then
|
||||||
|
# Rename the DMG to a consistent name in artifacts
|
||||||
cp "$dmg_src" "artifacts/YTSage-v${version}.dmg"
|
cp "$dmg_src" "artifacts/YTSage-v${version}.dmg"
|
||||||
echo "Copied DMG to artifacts: artifacts/YTSage-v${version}.dmg"
|
echo "Copied DMG to artifacts from $dmg_src -> artifacts/YTSage-v${version}.dmg"
|
||||||
else
|
else
|
||||||
echo "Warning: No DMG found in dist"
|
echo "Warning: No DMG found in dist/ or build/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Final artifacts:"
|
echo "Final artifacts:"
|
||||||
|
|||||||
Reference in New Issue
Block a user