Skip to content

Commit c66f949

Browse files
Updates build workflow a bit
Signed-off-by: Cole Gentry <peapod2007@gmail.com>
1 parent e3d4d86 commit c66f949

2 files changed

Lines changed: 92 additions & 69 deletions

File tree

.github/workflows/release.yml

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ jobs:
126126
run: |
127127
mkdir -p output
128128
129-
# Create app bundle structure
130-
APP_DIR="output/${{ env.APP_NAME }}-${{ matrix.arch }}.app"
129+
# Create app bundle structure (named just "UltraLog.app")
130+
APP_DIR="output/${{ env.APP_NAME }}.app"
131131
mkdir -p "$APP_DIR/Contents/MacOS"
132132
mkdir -p "$APP_DIR/Contents/Resources"
133133
@@ -187,6 +187,7 @@ jobs:
187187
echo -n "APPL????" > "$APP_DIR/Contents/PkgInfo"
188188
189189
# Create icon from PNG if exists
190+
ICNS_PATH=""
190191
if [ -f "assets/icons/mac.png" ]; then
191192
ICONSET_DIR=$(mktemp -d)/AppIcon.iconset
192193
mkdir -p "$ICONSET_DIR"
@@ -201,35 +202,45 @@ jobs:
201202
sips -z 512 512 "assets/icons/mac.png" --out "$ICONSET_DIR/icon_512x512.png"
202203
sips -z 1024 1024 "assets/icons/mac.png" --out "$ICONSET_DIR/icon_512x512@2x.png"
203204
iconutil -c icns "$ICONSET_DIR" -o "$APP_DIR/Contents/Resources/AppIcon.icns"
205+
ICNS_PATH="$APP_DIR/Contents/Resources/AppIcon.icns"
204206
fi
205207
206208
# Ad-hoc sign the app bundle
207209
codesign --force --deep --sign - "$APP_DIR"
208210
209-
# Create DMG
210-
create-dmg \
211-
--volname "${{ env.APP_NAME }}" \
212-
--window-pos 200 120 \
213-
--window-size 600 400 \
214-
--icon-size 100 \
215-
--icon "${{ env.APP_NAME }}-${{ matrix.arch }}.app" 150 190 \
216-
--hide-extension "${{ env.APP_NAME }}-${{ matrix.arch }}.app" \
217-
--app-drop-link 450 190 \
218-
"output/${{ matrix.asset_name }}.dmg" \
219-
"$APP_DIR" || \
220-
hdiutil create -volname "${{ env.APP_NAME }}" -srcfolder "$APP_DIR" -ov -format UDZO "output/${{ matrix.asset_name }}.dmg"
221-
222-
# Also create tar.gz of the app bundle
223-
cd output
224-
tar -czvf "${{ matrix.asset_name }}.tar.gz" "${{ env.APP_NAME }}-${{ matrix.arch }}.app"
211+
# Create DMG with volume icon if available
212+
if [ -n "$ICNS_PATH" ]; then
213+
create-dmg \
214+
--volname "${{ env.APP_NAME }}" \
215+
--volicon "$ICNS_PATH" \
216+
--window-pos 200 120 \
217+
--window-size 600 400 \
218+
--icon-size 100 \
219+
--icon "${{ env.APP_NAME }}.app" 150 190 \
220+
--hide-extension "${{ env.APP_NAME }}.app" \
221+
--app-drop-link 450 190 \
222+
"output/${{ matrix.asset_name }}.dmg" \
223+
"$APP_DIR" || \
224+
hdiutil create -volname "${{ env.APP_NAME }}" -srcfolder "$APP_DIR" -ov -format UDZO "output/${{ matrix.asset_name }}.dmg"
225+
else
226+
create-dmg \
227+
--volname "${{ env.APP_NAME }}" \
228+
--window-pos 200 120 \
229+
--window-size 600 400 \
230+
--icon-size 100 \
231+
--icon "${{ env.APP_NAME }}.app" 150 190 \
232+
--hide-extension "${{ env.APP_NAME }}.app" \
233+
--app-drop-link 450 190 \
234+
"output/${{ matrix.asset_name }}.dmg" \
235+
"$APP_DIR" || \
236+
hdiutil create -volname "${{ env.APP_NAME }}" -srcfolder "$APP_DIR" -ov -format UDZO "output/${{ matrix.asset_name }}.dmg"
237+
fi
225238
226239
- name: Upload artifact
227240
uses: actions/upload-artifact@v4
228241
with:
229242
name: ${{ matrix.asset_name }}
230-
path: |
231-
output/*.dmg
232-
output/*.tar.gz
243+
path: output/*.dmg
233244

234245
release:
235246
name: Create Release
@@ -255,9 +266,7 @@ jobs:
255266
with:
256267
files: |
257268
artifacts/ultralog-macos-intel/*.dmg
258-
artifacts/ultralog-macos-intel/*.tar.gz
259269
artifacts/ultralog-macos-arm64/*.dmg
260-
artifacts/ultralog-macos-arm64/*.tar.gz
261270
artifacts/ultralog-windows/*.zip
262271
artifacts/ultralog-linux/*.tar.gz
263272
draft: false
@@ -266,18 +275,13 @@ jobs:
266275
body: |
267276
## Installation
268277
269-
### macOS (Recommended: DMG)
278+
### macOS
270279
1. Download the appropriate `.dmg` file for your Mac:
271280
- **Intel Mac**: `ultralog-macos-intel.dmg`
272281
- **Apple Silicon (M1/M2/M3/M4)**: `ultralog-macos-arm64.dmg`
273282
2. Open the DMG and drag UltraLog to your Applications folder
274283
3. On first run, right-click the app and select "Open" to bypass Gatekeeper
275284
276-
### macOS (Alternative: tar.gz)
277-
1. Download and extract the `.tar.gz` file
278-
2. Move the `.app` to your Applications folder
279-
3. Remove quarantine: `xattr -cr /Applications/UltraLog*.app`
280-
281285
### Windows
282286
1. Download `ultralog-windows.zip`
283287
2. Extract the zip file

scripts/build-release.sh

Lines changed: 59 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,46 @@ clean() {
115115
print_success "Cleaned"
116116
}
117117

118+
# Convert PNG to ICNS
119+
create_icns_from_png() {
120+
local PNG_PATH=$1
121+
local ICNS_PATH=$2
122+
123+
local ICONSET_DIR=$(mktemp -d)/AppIcon.iconset
124+
mkdir -p "$ICONSET_DIR"
125+
126+
# Generate all required sizes
127+
sips -z 16 16 "$PNG_PATH" --out "$ICONSET_DIR/icon_16x16.png" >/dev/null 2>&1
128+
sips -z 32 32 "$PNG_PATH" --out "$ICONSET_DIR/icon_16x16@2x.png" >/dev/null 2>&1
129+
sips -z 32 32 "$PNG_PATH" --out "$ICONSET_DIR/icon_32x32.png" >/dev/null 2>&1
130+
sips -z 64 64 "$PNG_PATH" --out "$ICONSET_DIR/icon_32x32@2x.png" >/dev/null 2>&1
131+
sips -z 128 128 "$PNG_PATH" --out "$ICONSET_DIR/icon_128x128.png" >/dev/null 2>&1
132+
sips -z 256 256 "$PNG_PATH" --out "$ICONSET_DIR/icon_128x128@2x.png" >/dev/null 2>&1
133+
sips -z 256 256 "$PNG_PATH" --out "$ICONSET_DIR/icon_256x256.png" >/dev/null 2>&1
134+
sips -z 512 512 "$PNG_PATH" --out "$ICONSET_DIR/icon_256x256@2x.png" >/dev/null 2>&1
135+
sips -z 512 512 "$PNG_PATH" --out "$ICONSET_DIR/icon_512x512.png" >/dev/null 2>&1
136+
sips -z 1024 1024 "$PNG_PATH" --out "$ICONSET_DIR/icon_512x512@2x.png" >/dev/null 2>&1
137+
138+
# Convert to icns
139+
iconutil -c icns "$ICONSET_DIR" -o "$ICNS_PATH"
140+
141+
# Cleanup
142+
rm -rf "$(dirname "$ICONSET_DIR")"
143+
}
144+
118145
# Create macOS .app bundle
119146
create_app_bundle() {
120147
local ARCH=$1
121148
local BINARY_PATH=$2
122-
local APP_DIR="$OUTPUT_DIR/$APP_NAME-$ARCH.app"
149+
local BUILD_DIR="$OUTPUT_DIR/build-$ARCH"
150+
local APP_DIR="$BUILD_DIR/$APP_NAME.app"
123151

124152
echo "Creating app bundle for $ARCH..."
125153

154+
# Create build directory for this arch
155+
rm -rf "$BUILD_DIR"
156+
mkdir -p "$BUILD_DIR"
157+
126158
# Create bundle structure
127159
mkdir -p "$APP_DIR/Contents/MacOS"
128160
mkdir -p "$APP_DIR/Contents/Resources"
@@ -196,38 +228,13 @@ EOF
196228
print_success "Created: $APP_DIR"
197229
}
198230

199-
# Convert PNG to ICNS
200-
create_icns_from_png() {
201-
local PNG_PATH=$1
202-
local ICNS_PATH=$2
203-
204-
local ICONSET_DIR=$(mktemp -d)/AppIcon.iconset
205-
mkdir -p "$ICONSET_DIR"
206-
207-
# Generate all required sizes
208-
sips -z 16 16 "$PNG_PATH" --out "$ICONSET_DIR/icon_16x16.png" >/dev/null 2>&1
209-
sips -z 32 32 "$PNG_PATH" --out "$ICONSET_DIR/icon_16x16@2x.png" >/dev/null 2>&1
210-
sips -z 32 32 "$PNG_PATH" --out "$ICONSET_DIR/icon_32x32.png" >/dev/null 2>&1
211-
sips -z 64 64 "$PNG_PATH" --out "$ICONSET_DIR/icon_32x32@2x.png" >/dev/null 2>&1
212-
sips -z 128 128 "$PNG_PATH" --out "$ICONSET_DIR/icon_128x128.png" >/dev/null 2>&1
213-
sips -z 256 256 "$PNG_PATH" --out "$ICONSET_DIR/icon_128x128@2x.png" >/dev/null 2>&1
214-
sips -z 256 256 "$PNG_PATH" --out "$ICONSET_DIR/icon_256x256.png" >/dev/null 2>&1
215-
sips -z 512 512 "$PNG_PATH" --out "$ICONSET_DIR/icon_256x256@2x.png" >/dev/null 2>&1
216-
sips -z 512 512 "$PNG_PATH" --out "$ICONSET_DIR/icon_512x512.png" >/dev/null 2>&1
217-
sips -z 1024 1024 "$PNG_PATH" --out "$ICONSET_DIR/icon_512x512@2x.png" >/dev/null 2>&1
218-
219-
# Convert to icns
220-
iconutil -c icns "$ICONSET_DIR" -o "$ICNS_PATH"
221-
222-
# Cleanup
223-
rm -rf "$(dirname "$ICONSET_DIR")"
224-
}
225-
226231
# Create DMG
227232
create_dmg_file() {
228233
local ARCH=$1
229-
local APP_DIR="$OUTPUT_DIR/$APP_NAME-$ARCH.app"
234+
local BUILD_DIR="$OUTPUT_DIR/build-$ARCH"
235+
local APP_DIR="$BUILD_DIR/$APP_NAME.app"
230236
local DMG_PATH="$OUTPUT_DIR/$APP_NAME-$ARCH.dmg"
237+
local ICNS_PATH="$APP_DIR/Contents/Resources/AppIcon.icns"
231238

232239
echo "Creating DMG for $ARCH..."
233240

@@ -238,12 +245,12 @@ create_dmg_file() {
238245
# Use create-dmg for a nice DMG with background
239246
create-dmg \
240247
--volname "$APP_NAME" \
241-
--volicon "$APP_DIR/Contents/Resources/AppIcon.icns" \
248+
--volicon "$ICNS_PATH" \
242249
--window-pos 200 120 \
243250
--window-size 600 400 \
244251
--icon-size 100 \
245-
--icon "$APP_NAME-$ARCH.app" 150 190 \
246-
--hide-extension "$APP_NAME-$ARCH.app" \
252+
--icon "$APP_NAME.app" 150 190 \
253+
--hide-extension "$APP_NAME.app" \
247254
--app-drop-link 450 190 \
248255
"$DMG_PATH" \
249256
"$APP_DIR" \
@@ -283,11 +290,11 @@ build_macos() {
283290
create_dmg_file "intel"
284291
create_dmg_file "arm64"
285292

286-
# Also create tar.gz for GitHub releases
287-
echo "Creating tar.gz archives..."
288-
(cd "$OUTPUT_DIR" && tar -czvf "ultralog-macos-intel.tar.gz" "$APP_NAME-intel.app")
289-
(cd "$OUTPUT_DIR" && tar -czvf "ultralog-macos-arm64.tar.gz" "$APP_NAME-arm64.app")
290-
print_success "Created tar.gz archives"
293+
# Clean up build directories
294+
rm -rf "$OUTPUT_DIR/build-intel"
295+
rm -rf "$OUTPUT_DIR/build-arm64"
296+
297+
print_success "macOS build complete"
291298
}
292299

293300
# Build Linux
@@ -343,13 +350,25 @@ install_local() {
343350
APP_ARCH="intel"
344351
fi
345352

346-
APP_SRC="$OUTPUT_DIR/$APP_NAME-$APP_ARCH.app"
353+
BUILD_DIR="$OUTPUT_DIR/build-$APP_ARCH"
354+
APP_SRC="$BUILD_DIR/$APP_NAME.app"
347355
APP_DEST="/Applications/$APP_NAME.app"
348356

349-
# Check if app bundle exists
357+
# Check if app bundle exists, if not build it
350358
if [ ! -d "$APP_SRC" ]; then
351359
echo "App bundle not found. Building first..."
352-
build_macos
360+
361+
mkdir -p "$OUTPUT_DIR"
362+
363+
if [ "$APP_ARCH" = "arm64" ]; then
364+
echo "Building aarch64-apple-darwin (Apple Silicon)..."
365+
cargo build --release --target aarch64-apple-darwin
366+
create_app_bundle "arm64" "$PROJECT_DIR/target/aarch64-apple-darwin/release/ultralog"
367+
else
368+
echo "Building x86_64-apple-darwin (Intel)..."
369+
cargo build --release --target x86_64-apple-darwin
370+
create_app_bundle "intel" "$PROJECT_DIR/target/x86_64-apple-darwin/release/ultralog"
371+
fi
353372
fi
354373

355374
# Remove old installation

0 commit comments

Comments
 (0)