Skip to content

Commit 659fc65

Browse files
committed
background image for dmg
1 parent 520b5e0 commit 659fc65

3 files changed

Lines changed: 28 additions & 76 deletions

File tree

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

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ inputs:
1212
description: 'Volume name for the DMG'
1313
required: false
1414
default: 'CopyShot'
15+
dmg_background_path:
16+
description: 'Path to the background image for the DMG'
17+
required: false
18+
default: '.github/actions/create-dmg/background.jpg'
1519

1620
runs:
1721
using: composite
@@ -21,15 +25,6 @@ runs:
2125
run: |
2226
brew install create-dmg
2327
24-
- name: Set up Python
25-
uses: actions/setup-python@v5
26-
with:
27-
python-version: '3.x'
28-
29-
- name: Install dependencies
30-
shell: bash
31-
run: pip install Pillow
32-
3328
- name: Stage app for DMG
3429
shell: bash
3530
run: |
@@ -38,11 +33,13 @@ runs:
3833
mkdir -p dmg-stage
3934
cp -R "${{ inputs.app_path }}" "dmg-stage/CopyShot.app"
4035
ln -s /Applications "dmg-stage/Applications"
41-
42-
- name: Generate background image
43-
shell: bash
44-
run: |
45-
python3 .github/actions/create-dmg/scripts/generate_background.py "dmg-stage/background.png"
36+
37+
# Copy background image if provided and exists
38+
if [ -f "${{ inputs.dmg_background_path }}" ]; then
39+
cp "${{ inputs.dmg_background_path }}" "dmg-stage/background.jpg"
40+
else
41+
echo "::warning::Background image not found at ${{ inputs.dmg_background_path }}. DMG will be created without custom background."
42+
fi
4643
4744
- name: Create polished drag-to-Applications DMG
4845
shell: bash
@@ -51,16 +48,24 @@ runs:
5148
5249
# Ensure output directory exists
5350
mkdir -p "$(dirname "${{ inputs.dmg_output_path }}")"
54-
51+
52+
# Build create-dmg command args
53+
ARGS=(
54+
--volname "${{ inputs.volname }}"
55+
--window-pos 400 300
56+
--window-size 700 500
57+
--icon-size 140
58+
--icon "CopyShot.app" 180 225
59+
--icon "Applications" 520 225
60+
--hide-extension "CopyShot.app"
61+
)
62+
63+
if [ -f "dmg-stage/background.jpg" ]; then
64+
ARGS+=(--background "dmg-stage/background.jpg")
65+
fi
66+
5567
# Window and icon sizes/positions are in pixels.
5668
create-dmg \
57-
--volname "${{ inputs.volname }}" \
58-
--background "dmg-stage/background.png" \
59-
--window-pos 400 300 \
60-
--window-size 700 500 \
61-
--icon-size 140 \
62-
--icon "CopyShot.app" 180 225 \
63-
--icon "Applications" 520 225 \
64-
--hide-extension "CopyShot.app" \
69+
"${ARGS[@]}" \
6570
"${{ inputs.dmg_output_path }}" \
6671
"dmg-stage"
275 KB
Loading

.github/actions/create-dmg/scripts/generate_background.py

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)