Skip to content

Commit 064444e

Browse files
committed
fix a few issues with the github workflow for mac
1 parent d5a63b6 commit 064444e

1 file changed

Lines changed: 50 additions & 5 deletions

File tree

.github/workflows/build-flasher.yml

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,66 @@ jobs:
106106
echo "✅ Version set to: $VERSION"
107107
echo "✅ Build number set to: $BUILD_NUMBER"
108108
109+
- name: Clean up volumes and temp directories (macOS)
110+
if: matrix.os == 'macos-latest'
111+
shell: bash
112+
run: |
113+
echo "Cleaning up volumes and temp directories..."
114+
# Unmount any residual DMG volumes
115+
for vol in $(mount | grep '/Volumes/' | awk '{print $3}' || true); do
116+
if [ -n "$vol" ]; then
117+
echo "Unmounting volume: $vol"
118+
hdiutil detach "$vol" -force 2>/dev/null || true
119+
fi
120+
done
121+
# Clean workspace temp files
122+
rm -rf "${{ github.workspace }}/flash_tool/dist"/* 2>/dev/null || true
123+
echo "✅ Cleanup complete"
124+
109125
- name: Build Electron app (macOS)
110126
if: matrix.os == 'macos-latest'
111127
working-directory: flash_tool
112128
shell: bash
113129
run: |
114-
# Build with explicit version and build number to ensure uniqueness
115-
npx electron-builder --mac \
116-
--config.mac.bundleVersion=${{ env.BUILD_NUMBER }} \
117-
--config.extraMetadata.version=${{ env.APP_VERSION }} \
118-
--publish never
130+
echo "Building for ARM64 (Apple Silicon) only..."
131+
132+
# Retry logic for hdiutil transient failures
133+
MAX_ATTEMPTS=3
134+
ATTEMPT=1
135+
while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
136+
echo "Build attempt $ATTEMPT of $MAX_ATTEMPTS..."
137+
138+
# Build with explicit version and build number to ensure uniqueness
139+
# Build for ARM64 only (Apple Silicon) to avoid hdiutil conflicts
140+
if npx electron-builder --mac --arm64 \
141+
--config.mac.bundleVersion=${{ env.BUILD_NUMBER }} \
142+
--config.extraMetadata.version=${{ env.APP_VERSION }} \
143+
--publish never; then
144+
echo "✅ Build succeeded on attempt $ATTEMPT"
145+
break
146+
else
147+
if [ $ATTEMPT -eq $MAX_ATTEMPTS ]; then
148+
echo "❌ Build failed after $MAX_ATTEMPTS attempts"
149+
exit 1
150+
fi
151+
echo "⚠️ Build attempt $ATTEMPT failed, cleaning up and retrying..."
152+
# Clean up volumes and wait before retry
153+
for vol in $(mount | grep '/Volumes/' | awk '{print $3}' || true); do
154+
if [ -n "$vol" ]; then
155+
hdiutil detach "$vol" -force 2>/dev/null || true
156+
fi
157+
done
158+
sleep 5
159+
ATTEMPT=$((ATTEMPT + 1))
160+
fi
161+
done
119162
env:
120163
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121164
CSC_IDENTITY_AUTO_DISCOVERY: false
122165
APP_VERSION: ${{ env.APP_VERSION }}
123166
BUILD_NUMBER: ${{ env.BUILD_NUMBER }}
167+
DEBUG: electron-builder
168+
DEBUG_DMG: "true"
124169

125170
- name: Remove quarantine attributes (macOS)
126171
if: matrix.os == 'macos-latest'

0 commit comments

Comments
 (0)