name: Build Windows Client on: workflow_dispatch: # 手動觸發 inputs: api_url: description: 'Backend API URL (e.g., http://192.168.1.100:8000/api)' required: false default: 'http://localhost:8000/api' type: string whisper_model: description: 'Whisper model size' required: false default: 'medium' type: choice options: - tiny - base - small - medium - large push: tags: - 'v*' # 推送版本 tag 時自動觸發 jobs: build-sidecar: name: Build Sidecar (Python → exe) runs-on: windows-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.11' cache: 'pip' cache-dependency-path: sidecar/requirements.txt - name: Install sidecar dependencies working-directory: sidecar run: | python -m pip install --upgrade pip pip install -r requirements.txt pip install pyinstaller - name: Build sidecar with PyInstaller working-directory: sidecar run: | pyinstaller ` --onedir ` --name transcriber ` --distpath dist ` --workpath build ` --noconfirm ` --clean ` --console ` --hidden-import=faster_whisper ` --hidden-import=ctranslate2 ` --hidden-import=huggingface_hub ` --hidden-import=tokenizers ` --hidden-import=onnxruntime ` --hidden-import=opencc ` --hidden-import=pydub ` --hidden-import=numpy ` --hidden-import=av ` --collect-data=onnxruntime ` --collect-data=faster_whisper ` transcriber.py - name: Upload sidecar artifact uses: actions/upload-artifact@v4 with: name: sidecar-windows path: sidecar/dist/transcriber/ retention-days: 1 build-electron: name: Build Electron App needs: build-sidecar runs-on: windows-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' cache-dependency-path: client/package-lock.json - name: Download sidecar artifact uses: actions/download-artifact@v4 with: name: sidecar-windows path: sidecar/dist/transcriber/ - name: Install client dependencies working-directory: client run: npm ci - name: Update config.json with API URL working-directory: client shell: pwsh run: | $configPath = "config.json" $apiUrl = "${{ inputs.api_url || 'http://localhost:8000/api' }}" if (Test-Path $configPath) { $config = Get-Content $configPath -Raw | ConvertFrom-Json $config.apiBaseUrl = $apiUrl $config | ConvertTo-Json -Depth 10 | Set-Content $configPath -Encoding UTF8 Write-Host "Updated API URL to: $apiUrl" } - name: Build Electron app working-directory: client run: npm run build -- --win env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload Windows build uses: actions/upload-artifact@v4 with: name: meeting-assistant-windows path: | client/dist/*.exe client/dist/*.zip retention-days: 30 release: name: Create Release needs: build-electron runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/v') steps: - name: Download Windows build uses: actions/download-artifact@v4 with: name: meeting-assistant-windows path: dist/ - name: Create Release uses: softprops/action-gh-release@v1 with: files: dist/* draft: true generate_release_notes: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}