Skip to content

Commit 54a03e9

Browse files
committed
Enhance GitHub Actions workflow for binary detection and packaging
- Updated the release workflow to dynamically find and copy the standalone binaries for Linux, Windows, and macOS, improving the reliability of the build process. - Implemented checks to ensure binaries are located in potentially nested directory structures, enhancing compatibility across different environments. These changes streamline the release process by ensuring the correct binaries are packaged for each platform.
1 parent b83ce20 commit 54a03e9

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

.github/workflows/release.yml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,13 @@ jobs:
353353
# Create a clean release directory
354354
mkdir -p release_artifacts
355355
356+
# Linux: Find the binary (it may be in a nested directory structure)
357+
LINUX_BINARY=$(find artifacts/linux -name "budget-planer" -type f ! -name "*.exe" 2>/dev/null | head -1)
358+
356359
# Linux: Create portable ZIP with binary + backend-server
357-
if [ -f "artifacts/linux/budget-planer" ]; then
360+
if [ -n "$LINUX_BINARY" ] && [ -f "$LINUX_BINARY" ]; then
358361
mkdir -p portable-linux
359-
cp artifacts/linux/budget-planer portable-linux/
362+
cp "$LINUX_BINARY" portable-linux/budget-planer
360363
chmod +x portable-linux/budget-planer
361364
# Find and copy backend-server
362365
BACKEND=$(find artifacts/linux -name "backend-server" -type f ! -name "*.exe" 2>/dev/null | head -1)
@@ -372,8 +375,8 @@ jobs:
372375
fi
373376
374377
# Linux: Add standalone binary
375-
if [ -f "artifacts/linux/budget-planer" ]; then
376-
cp artifacts/linux/budget-planer release_artifacts/budget-planer-linux
378+
if [ -n "$LINUX_BINARY" ] && [ -f "$LINUX_BINARY" ]; then
379+
cp "$LINUX_BINARY" release_artifacts/budget-planer-linux
377380
chmod +x release_artifacts/budget-planer-linux
378381
echo "✓ Added Linux standalone binary"
379382
fi
@@ -392,10 +395,13 @@ jobs:
392395
echo "✓ Added Linux RPM package: $(basename "$file")"
393396
done
394397
398+
# Windows: Find the binary (it may be in a nested directory structure)
399+
WINDOWS_BINARY=$(find artifacts/windows -name "budget-planer.exe" -type f 2>/dev/null | head -1)
400+
395401
# Windows: Create portable ZIP with binary + backend-server
396-
if [ -f "artifacts/windows/budget-planer.exe" ]; then
402+
if [ -n "$WINDOWS_BINARY" ] && [ -f "$WINDOWS_BINARY" ]; then
397403
mkdir -p portable-windows
398-
cp artifacts/windows/budget-planer.exe portable-windows/
404+
cp "$WINDOWS_BINARY" portable-windows/budget-planer.exe
399405
# Find and copy backend-server.exe
400406
BACKEND=$(find artifacts/windows -name "backend-server.exe" -type f 2>/dev/null | head -1)
401407
if [ -n "$BACKEND" ] && [ -f "$BACKEND" ]; then
@@ -423,15 +429,18 @@ jobs:
423429
done
424430
425431
# Windows: Add standalone binary
426-
if [ -f "artifacts/windows/budget-planer.exe" ]; then
427-
cp artifacts/windows/budget-planer.exe release_artifacts/budget-planer-windows.exe
432+
if [ -n "$WINDOWS_BINARY" ] && [ -f "$WINDOWS_BINARY" ]; then
433+
cp "$WINDOWS_BINARY" release_artifacts/budget-planer-windows.exe
428434
echo "✓ Added Windows standalone binary"
429435
fi
430436
437+
# macOS: Find the binary (it may be in a nested directory structure)
438+
MACOS_BINARY=$(find artifacts/macos -name "budget-planer" -type f ! -name "*.exe" 2>/dev/null | head -1)
439+
431440
# macOS: Create portable ZIP with binary + backend-server
432-
if [ -f "artifacts/macos/budget-planer" ]; then
441+
if [ -n "$MACOS_BINARY" ] && [ -f "$MACOS_BINARY" ]; then
433442
mkdir -p portable-macos
434-
cp artifacts/macos/budget-planer portable-macos/
443+
cp "$MACOS_BINARY" portable-macos/budget-planer
435444
chmod +x portable-macos/budget-planer
436445
# Find and copy backend-server
437446
BACKEND=$(find artifacts/macos -name "backend-server" -type f ! -name "*.exe" 2>/dev/null | head -1)
@@ -447,8 +456,8 @@ jobs:
447456
fi
448457
449458
# macOS: Add standalone binary
450-
if [ -f "artifacts/macos/budget-planer" ]; then
451-
cp artifacts/macos/budget-planer release_artifacts/budget-planer-macos
459+
if [ -n "$MACOS_BINARY" ] && [ -f "$MACOS_BINARY" ]; then
460+
cp "$MACOS_BINARY" release_artifacts/budget-planer-macos
452461
chmod +x release_artifacts/budget-planer-macos
453462
echo "✓ Added macOS standalone binary"
454463
fi

0 commit comments

Comments
 (0)