Skip to content

Commit b0a702f

Browse files
committed
feat: added icons to gui and also make a real dmg
1 parent e6028a0 commit b0a702f

19 files changed

Lines changed: 761 additions & 649 deletions

.github/scripts/package-macos.sh

100644100755
Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ cat > FastPack.app/Contents/Info.plist << 'PLIST'
1919
<plist version="1.0">
2020
<dict>
2121
<key>CFBundleExecutable</key><string>fastpack</string>
22-
<key>CFBundleIdentifier</key><string>com.hexeption.fastpack</string>
22+
<key>CFBundleIdentifier</key><string>uk.co.hexeption.fastpack</string>
2323
<key>CFBundleName</key><string>FastPack</string>
2424
<key>CFBundleDisplayName</key><string>FastPack</string>
2525
<key>CFBundlePackageType</key><string>APPL</string>
@@ -30,22 +30,59 @@ cat > FastPack.app/Contents/Info.plist << 'PLIST'
3030
</plist>
3131
PLIST
3232

33-
ICO=$(find target -name 'icon.ico' -print -quit)
33+
ICO=$(find assets -name 'icon.svg' -print -quit)
3434
if [ -n "$ICO" ]; then
3535
mkdir -p icon.iconset
36-
for sz in 16 32 64 128 256 512; do
37-
sips -z $sz $sz "$ICO" --out "icon.iconset/icon_${sz}x${sz}.png" 2>/dev/null || true
38-
done
39-
for sz in 16 32 64 128 256; do
40-
sz2=$((sz * 2))
41-
cp "icon.iconset/icon_${sz2}x${sz2}.png" \
42-
"icon.iconset/icon_${sz}x${sz}@2x.png" 2>/dev/null || true
36+
37+
SIZES="
38+
16,16x16
39+
32,16x16@2x
40+
32,32x32
41+
64,32x32@2x
42+
128,128x128
43+
256,128x128@2x
44+
256,256x256
45+
512,256x256@2x
46+
512,512x512
47+
1024,512x512@2x
48+
"
49+
50+
for PARAMS in $SIZES; do
51+
SIZE=$(echo "$PARAMS" | cut -d, -f1)
52+
LABEL=$(echo "$PARAMS" | cut -d, -f2)
53+
svg2png -w "$SIZE" -h "$SIZE" "$ICO" "icon.iconset/icon_${LABEL}.png"
4354
done
55+
4456
iconutil -c icns icon.iconset -o FastPack.app/Contents/Resources/AppIcon.icns
4557
fi
4658

47-
hdiutil create \
48-
-volname "FastPack" \
49-
-srcfolder FastPack.app \
50-
-ov -format UDZO \
51-
"$ARTIFACT"
59+
# Convert DMG background SVG to PNG
60+
BG=$(find assets -name 'dmg-background.svg' -print -quit)
61+
if [ -n "$BG" ]; then
62+
mkdir -p dmg-bg
63+
svg2png -w 540 -h 380 "$BG" dmg-bg/background.png
64+
fi
65+
66+
npm install -g appdmg
67+
68+
cat > appdmg_config.json << 'CONFIG'
69+
{
70+
"title": "FastPack",
71+
"icon": "FastPack.app/Contents/Resources/AppIcon.icns",
72+
"background": "dmg-bg/background.png",
73+
"background-color": "#000000",
74+
"icon-size": 64,
75+
"window": {
76+
"position": { "x": 400, "y": 100 },
77+
"size": { "width": 540, "height": 380 }
78+
},
79+
"contents": [
80+
{ "x": 160, "y": 195, "type": "file", "path": "FastPack.app" },
81+
{ "x": 380, "y": 195, "type": "link", "path": "/Applications" }
82+
]
83+
}
84+
CONFIG
85+
86+
appdmg appdmg_config.json "$ARTIFACT"
87+
88+
rm -rf FastPack.app dmg-bg appdmg_config.json

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ jobs:
6969
- name: package macOS DMG
7070
if: runner.os == 'macOS'
7171
run: |
72+
brew install svg2png
7273
bash .github/scripts/package-macos.sh \
7374
"target/${{ matrix.target }}/release/fastpack" \
7475
"${{ matrix.artifact }}"

0 commit comments

Comments
 (0)