Skip to content

Commit 6385be0

Browse files
committed
fix v3
1 parent 0ba9fe2 commit 6385be0

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

.github/actions/create-dmg/action.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,23 @@ runs:
3636
3737
# Copy background image if provided and exists
3838
if [ -f "${{ inputs.dmg_background_path }}" ]; then
39-
cp "${{ inputs.dmg_background_path }}" "dmg-stage/background.jpg"
40-
41-
# Check image width to determine if it's Retina (@2x) (1400px)
42-
WIDTH=$(sips -g pixelWidth "dmg-stage/background.jpg" | awk '/pixelWidth/ {print $2}')
39+
# Check image width to determine if it's Retina (@2x)
40+
WIDTH=$(sips -g pixelWidth "${{ inputs.dmg_background_path }}" | awk '/pixelWidth/ {print $2}')
4341
4442
if [ "$WIDTH" -gt 700 ]; then
45-
echo "Detected high-resolution background ($WIDTH px width). Setting DPI to 144 for Retina display."
46-
sips -s dpiHeight 144.0 -s dpiWidth 144.0 "dmg-stage/background.jpg"
43+
echo "Detected high-resolution background ($WIDTH px width). Creating multi-resolution TIFF."
44+
45+
# Create a temporary downscaled 1x version (700x500)
46+
sips -z 500 700 "${{ inputs.dmg_background_path }}" --out "dmg-stage/background_1x.jpg"
47+
48+
# Combine original (2x) and downscaled (1x) into a multi-resolution TIFF
49+
# @2x image must be named with @2x for some tools, but tiffutil -cathidpi loves simple inputs
50+
tiffutil -cathidpi "dmg-stage/background_1x.jpg" "${{ inputs.dmg_background_path }}" -out "dmg-stage/background.tiff"
51+
52+
echo "Created multi-resolution background.tiff"
4753
else
48-
echo "Detected standard-resolution background ($WIDTH px width). Keeping standard DPI."
49-
sips -s dpiHeight 72.0 -s dpiWidth 72.0 "dmg-stage/background.jpg"
54+
echo "Detected standard-resolution background ($WIDTH px width). Using as-is."
55+
cp "${{ inputs.dmg_background_path }}" "dmg-stage/background.tiff"
5056
fi
5157
else
5258
echo "::warning::Background image not found at ${{ inputs.dmg_background_path }}. DMG will be created without custom background."
@@ -71,8 +77,8 @@ runs:
7177
--hide-extension "CopyShot.app"
7278
)
7379
74-
if [ -f "dmg-stage/background.jpg" ]; then
75-
ARGS+=(--background "dmg-stage/background.jpg")
80+
if [ -f "dmg-stage/background.tiff" ]; then
81+
ARGS+=(--background "dmg-stage/background.tiff")
7682
fi
7783
7884
# Window and icon sizes/positions are in pixels.

0 commit comments

Comments
 (0)