From 7a84f9e320575dbff3df64afb0189de2558094de Mon Sep 17 00:00:00 2001 From: jim800121chen Date: Sat, 7 Mar 2026 04:24:24 +0800 Subject: [PATCH] ci: add GitHub Actions workflow for macOS + Windows installer builds Co-Authored-By: Claude Opus 4.6 --- .github/workflows/build-installer.yaml | 149 +++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 .github/workflows/build-installer.yaml diff --git a/.github/workflows/build-installer.yaml b/.github/workflows/build-installer.yaml new file mode 100644 index 0000000..5738706 --- /dev/null +++ b/.github/workflows/build-installer.yaml @@ -0,0 +1,149 @@ +name: Build Installers + +on: + push: + tags: + - 'v*' + workflow_dispatch: + +env: + WORK_DIR: edge-ai-platform + +jobs: + build-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.23' + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install pnpm + run: npm install -g pnpm + + - name: Install Wails + run: go install github.com/wailsapp/wails/v2/cmd/wails@latest + + - name: Install frontend dependencies + run: cd $WORK_DIR/frontend && pnpm install --frozen-lockfile + + - name: Build frontend + run: cd $WORK_DIR && make build-frontend build-embed + + - name: Build server (tray-enabled) + run: cd $WORK_DIR && make build-server-tray + + - name: Stage installer payload + run: cd $WORK_DIR && make installer-payload + + - name: Build macOS installer + run: | + cd $WORK_DIR/installer && wails build -clean + codesign --force --deep --sign - build/bin/EdgeAI-Installer.app + + - name: Package macOS installer + run: | + cd $WORK_DIR/installer/build/bin + ditto -c -k --sequesterRsrc --keepParent EdgeAI-Installer.app EdgeAI-Installer-macOS.zip + + - name: Upload macOS artifact + uses: actions/upload-artifact@v4 + with: + name: EdgeAI-Installer-macOS + path: ${{ env.WORK_DIR }}/installer/build/bin/EdgeAI-Installer-macOS.zip + + build-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.23' + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install pnpm + run: npm install -g pnpm + + - name: Install Wails + run: go install github.com/wailsapp/wails/v2/cmd/wails@latest + + - name: Install frontend dependencies + run: cd edge-ai-platform\frontend && pnpm install --frozen-lockfile + + - name: Build frontend + run: | + cd edge-ai-platform\frontend && pnpm build + xcopy /E /I /Y out ..\server\web\out + + - name: Build server (no tray on Windows CI) + run: | + cd edge-ai-platform\server + $env:CGO_ENABLED="0" + go build -tags notray -ldflags="-s -w" -o ..\dist\edge-ai-server.exe main.go + + - name: Stage installer payload + run: | + $base = "edge-ai-platform" + Remove-Item -Recurse -Force "$base\installer\payload" -ErrorAction SilentlyContinue + New-Item -ItemType Directory -Force -Path "$base\installer\payload\data\nef\kl520" + New-Item -ItemType Directory -Force -Path "$base\installer\payload\data\nef\kl720" + New-Item -ItemType Directory -Force -Path "$base\installer\payload\scripts\firmware\KL520" + New-Item -ItemType Directory -Force -Path "$base\installer\payload\scripts\firmware\KL720" + Copy-Item "$base\dist\edge-ai-server.exe" "$base\installer\payload\" + Copy-Item "$base\server\data\models.json" "$base\installer\payload\data\" + Copy-Item "$base\server\data\nef\kl520\*.nef" "$base\installer\payload\data\nef\kl520\" + Copy-Item "$base\server\data\nef\kl720\*.nef" "$base\installer\payload\data\nef\kl720\" + Copy-Item "$base\server\scripts\kneron_bridge.py" "$base\installer\payload\scripts\" + Copy-Item "$base\server\scripts\requirements.txt" "$base\installer\payload\scripts\" + Copy-Item "$base\server\scripts\update_kl720_firmware.py" "$base\installer\payload\scripts\" + Copy-Item "$base\scripts\kneron_detect.py" "$base\installer\payload\scripts\" + Copy-Item "$base\server\scripts\firmware\KL520\*.bin" "$base\installer\payload\scripts\firmware\KL520\" + Copy-Item "$base\server\scripts\firmware\KL720\*.bin" "$base\installer\payload\scripts\firmware\KL720\" + + - name: Build Windows installer + run: | + cd edge-ai-platform\installer + wails build -clean + + - name: Package Windows installer + run: | + Compress-Archive -Path edge-ai-platform\installer\build\bin\EdgeAI-Installer.exe -DestinationPath edge-ai-platform\installer\build\bin\EdgeAI-Installer-Windows.zip + + - name: Upload Windows artifact + uses: actions/upload-artifact@v4 + with: + name: EdgeAI-Installer-Windows + path: edge-ai-platform/installer/build/bin/EdgeAI-Installer-Windows.zip + + release: + needs: [build-macos, build-windows] + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + steps: + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + files: | + artifacts/EdgeAI-Installer-macOS/EdgeAI-Installer-macOS.zip + artifacts/EdgeAI-Installer-Windows/EdgeAI-Installer-Windows.zip + draft: false + prerelease: false + generate_release_notes: true