Skip to content

Commit 6e5738f

Browse files
authored
Merge pull request #45 from zero-ide/feature/release-automation
feature/release-automation | 릴리스 자동화 및 앱 아이콘 생성
2 parents 3603bae + 9cc06ce commit 6e5738f

9 files changed

Lines changed: 403 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Loading
Lines changed: 20 additions & 0 deletions
Loading
Lines changed: 20 additions & 0 deletions
Loading
Lines changed: 20 additions & 0 deletions
Loading
Lines changed: 20 additions & 0 deletions
Loading
Lines changed: 20 additions & 0 deletions
Loading
Lines changed: 20 additions & 0 deletions
Loading

scripts/generate-icons.sh

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
#!/bin/bash
2+
3+
# Generate macOS App Icons from SVG
4+
# Usage: ./scripts/generate-icons.sh
5+
6+
set -e
7+
8+
APP_NAME="Zero"
9+
RESOURCES_DIR="Sources/Zero/Resources"
10+
ICONSET_DIR="${RESOURCES_DIR}/AppIcon.iconset"
11+
12+
echo "🎨 Generating macOS app icons..."
13+
14+
# Check if logo.svg exists
15+
if [ ! -f "${RESOURCES_DIR}/logo.svg" ]; then
16+
echo "❌ Error: logo.svg not found in ${RESOURCES_DIR}"
17+
exit 1
18+
fi
19+
20+
# Create iconset directory
21+
mkdir -p "${ICONSET_DIR}"
22+
23+
# Generate icons at different sizes
24+
# macOS requires: 16x16, 32x32, 64x64, 128x128, 256x256, 512x512, 1024x1024
25+
# @1x and @2x versions
26+
27+
echo "📐 Generating icon sizes..."
28+
29+
# 16x16 (16x16@1x, 16x16@2x=32x32)
30+
# Not needed separately, will use 32x32 for @2x
31+
32+
# 32x32 (32x32@1x, 32x32@2x=64x64)
33+
# Not needed separately, will use 64x64 for @2x
34+
35+
# 128x128 (128x128@1x, 128x128@2x=256x256)
36+
sips -z 128 128 "${RESOURCES_DIR}/logo.svg" --out "${ICONSET_DIR}/icon_128x128.png" 2>/dev/null || \
37+
rsvg-convert -w 128 -h 128 "${RESOURCES_DIR}/logo.svg" -o "${ICONSET_DIR}/icon_128x128.png"
38+
39+
sips -z 256 256 "${RESOURCES_DIR}/logo.svg" --out "${ICONSET_DIR}/icon_128x128@2x.png" 2>/dev/null || \
40+
rsvg-convert -w 256 -h 256 "${RESOURCES_DIR}/logo.svg" -o "${ICONSET_DIR}/icon_128x128@2x.png"
41+
42+
# 256x256 (256x256@1x, 256x256@2x=512x512)
43+
sips -z 256 256 "${RESOURCES_DIR}/logo.svg" --out "${ICONSET_DIR}/icon_256x256.png" 2>/dev/null || \
44+
rsvg-convert -w 256 -h 256 "${RESOURCES_DIR}/logo.svg" -o "${ICONSET_DIR}/icon_256x256.png"
45+
46+
sips -z 512 512 "${RESOURCES_DIR}/logo.svg" --out "${ICONSET_DIR}/icon_256x256@2x.png" 2>/dev/null || \
47+
rsvg-convert -w 512 -h 512 "${RESOURCES_DIR}/logo.svg" -o "${ICONSET_DIR}/icon_256x256@2x.png"
48+
49+
# 512x512 (512x512@1x, 512x512@2x=1024x1024)
50+
sips -z 512 512 "${RESOURCES_DIR}/logo.svg" --out "${ICONSET_DIR}/icon_512x512.png" 2>/dev/null || \
51+
rsvg-convert -w 512 -h 512 "${RESOURCES_DIR}/logo.svg" -o "${ICONSET_DIR}/icon_512x512.png"
52+
53+
sips -z 1024 1024 "${RESOURCES_DIR}/logo.svg" --out "${ICONSET_DIR}/icon_512x512@2x.png" 2>/dev/null || \
54+
rsvg-convert -w 1024 -h 1024 "${RESOURCES_DIR}/logo.svg" -o "${ICONSET_DIR}/icon_512x512@2x.png"
55+
56+
# Alternative: Use ImageMagick if available
57+
if command -v convert &> /dev/null; then
58+
echo "✨ Using ImageMagick for better SVG rendering..."
59+
60+
for size in 16 32 64 128 256 512 1024; do
61+
if [ $size -eq 1024 ]; then
62+
output="${ICONSET_DIR}/icon_512x512@2x.png"
63+
elif [ $size -eq 512 ]; then
64+
output="${ICONSET_DIR}/icon_512x512.png"
65+
elif [ $size -eq 256 ]; then
66+
output="${ICONSET_DIR}/icon_256x256.png"
67+
elif [ $size -eq 128 ]; then
68+
output="${ICONSET_DIR}/icon_128x128.png"
69+
else
70+
output="${ICONSET_DIR}/icon_${size}x${size}.png"
71+
fi
72+
73+
convert -background none -resize ${size}x${size} "${RESOURCES_DIR}/logo.svg" "${output}" 2>/dev/null || true
74+
done
75+
76+
# Create @2x versions
77+
convert -background none -resize 32x32 "${RESOURCES_DIR}/logo.svg" "${ICONSET_DIR}/icon_16x16@2x.png" 2>/dev/null || true
78+
convert -background none -resize 64x64 "${RESOURCES_DIR}/logo.svg" "${ICONSET_DIR}/icon_32x32@2x.png" 2>/dev/null || true
79+
fi
80+
81+
echo "📦 Creating .icns file..."
82+
83+
# Convert iconset to icns
84+
iconutil -c icns "${ICONSET_DIR}" -o "${RESOURCES_DIR}/AppIcon.icns" || {
85+
echo "⚠️ Warning: iconutil failed. Using fallback method..."
86+
87+
# Fallback: Use png2icns if available
88+
if command -v png2icns &> /dev/null; then
89+
png2icns "${RESOURCES_DIR}/AppIcon.icns" \
90+
"${ICONSET_DIR}/icon_16x16.png" \
91+
"${ICONSET_DIR}/icon_32x32.png" \
92+
"${ICONSET_DIR}/icon_128x128.png" \
93+
"${ICONSET_DIR}/icon_256x256.png" \
94+
"${ICONSET_DIR}/icon_512x512.png" \
95+
"${ICONSET_DIR}/icon_512x512@2x.png" 2>/dev/null || true
96+
fi
97+
}
98+
99+
# Clean up iconset directory (keep it for reference)
100+
# rm -rf "${ICONSET_DIR}"
101+
102+
echo ""
103+
echo "✅ Icons generated successfully!"
104+
echo ""
105+
echo "📦 Files created:"
106+
echo " - ${RESOURCES_DIR}/AppIcon.icns"
107+
echo " - ${ICONSET_DIR}/ (iconset directory)"
108+
echo ""
109+
echo "📝 To use in your app:"
110+
echo " 1. Add AppIcon.icns to your Xcode project"
111+
echo " 2. Set CFBundleIconFile in Info.plist"
112+
echo ""

0 commit comments

Comments
 (0)