chore(electron): bump version to 0.6.4 #136
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Electron 桌面客户端 — 开发构建 CI | |
| # 与 Tauri 的 ci-tauri.yml 分开:仅监听 Electron 相关路径,构建无签名包并上传 Artifacts。 | |
| # | |
| # 触发方式: | |
| # - 推送到配置的分支时,仅当 crates/agent-electron-client/** 等路径有变更 | |
| # - Pull Request 时同上路径过滤 | |
| # - 手动触发 workflow_dispatch(可选平台) | |
| # | |
| # 与 release-electron.yml 的区别: | |
| # - 不创建 GitHub Release,产物为 Actions Artifacts(保留约 7 天) | |
| # - 不签名、不公证(Mac 为无签名包) | |
| # - 用于日常开发与 PR 验证 | |
| name: Electron Desktop Client (Testing Build) | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - dev | |
| - "feature/electron-*" | |
| paths: | |
| - "crates/agent-electron-client/**" | |
| - "vendors/nuwaxcode-sdk/**" | |
| - ".github/workflows/ci-electron.yml" | |
| pull_request: | |
| paths: | |
| - "crates/agent-electron-client/**" | |
| - "vendors/nuwaxcode-sdk/**" | |
| - ".github/workflows/ci-electron.yml" | |
| workflow_dispatch: | |
| inputs: | |
| platform: | |
| description: "构建平台" | |
| required: true | |
| default: "all" | |
| type: choice | |
| options: | |
| - all | |
| - mac | |
| - win | |
| - linux | |
| - linux-arm64 | |
| permissions: | |
| contents: read | |
| jobs: | |
| setup-matrix: | |
| name: Setup matrix | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.out.outputs.matrix }} | |
| steps: | |
| - id: out | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| case "${{ github.event.inputs.platform }}" in | |
| mac) echo 'matrix={"include":[{"platform":"macos-latest","dist_cmd":"dist:mac:unsigned","artifact_os":"mac"}]}' >> "$GITHUB_OUTPUT" ;; | |
| win) echo 'matrix={"include":[{"platform":"windows-latest","dist_cmd":"dist:win","artifact_os":"win"}]}' >> "$GITHUB_OUTPUT" ;; | |
| linux) echo 'matrix={"include":[{"platform":"ubuntu-latest","dist_cmd":"dist:linux:x64","artifact_os":"linux-x64"}]}' >> "$GITHUB_OUTPUT" ;; | |
| linux-arm64) echo 'matrix={"include":[{"platform":"ubuntu-24.04-arm","dist_cmd":"dist:linux:arm64","artifact_os":"linux-arm64"}]}' >> "$GITHUB_OUTPUT" ;; | |
| *) echo 'matrix={"include":[{"platform":"macos-latest","dist_cmd":"dist:mac:unsigned","artifact_os":"mac"},{"platform":"windows-latest","dist_cmd":"dist:win","artifact_os":"win"},{"platform":"ubuntu-latest","dist_cmd":"dist:linux:x64","artifact_os":"linux-x64"},{"platform":"ubuntu-24.04-arm","dist_cmd":"dist:linux:arm64","artifact_os":"linux-arm64"}]}' >> "$GITHUB_OUTPUT" ;; | |
| esac | |
| else | |
| echo 'matrix={"include":[{"platform":"macos-latest","dist_cmd":"dist:mac:unsigned","artifact_os":"mac"},{"platform":"windows-latest","dist_cmd":"dist:win","artifact_os":"win"},{"platform":"ubuntu-latest","dist_cmd":"dist:linux:x64","artifact_os":"linux-x64"},{"platform":"ubuntu-24.04-arm","dist_cmd":"dist:linux:arm64","artifact_os":"linux-arm64"}]}' >> "$GITHUB_OUTPUT" | |
| fi | |
| build-electron: | |
| name: Build Electron (${{ matrix.platform }}) | |
| needs: setup-matrix | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set short SHA | |
| id: sha | |
| run: echo "short=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT" | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| cache: npm | |
| cache-dependency-path: crates/agent-electron-client/package-lock.json | |
| # Python 3.12+ 移除了 distutils,node-gyp(better-sqlite3 等 native 模块)依赖它 | |
| - name: Install setuptools for node-gyp (Python 3.12+) | |
| shell: bash | |
| run: python3 -m pip install setuptools --break-system-packages 2>/dev/null || python3 -m pip install setuptools | |
| # Linux 构建 deb/rpm 包需要 rpm 工具;arm64 runner 需要系统 fpm(内置 fpm 仅 x86) | |
| - name: Install Linux build tools | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y rpm ruby ruby-dev | |
| sudo gem install fpm | |
| echo "USE_SYSTEM_FPM=true" >> "$GITHUB_ENV" | |
| - name: Install dependencies | |
| working-directory: crates/agent-electron-client | |
| run: npm install | |
| - name: Run unit tests | |
| working-directory: crates/agent-electron-client | |
| run: npm run test:run | |
| - name: Check import boundaries | |
| working-directory: crates/agent-electron-client | |
| run: npm run check:boundaries | |
| # 缓存内置 Node.js(所有平台)、Git(仅 Windows)和 uv(所有平台) | |
| - name: Cache bundled Node.js | |
| uses: actions/cache@v4 | |
| with: | |
| path: crates/agent-electron-client/resources/node | |
| key: bundled-node-24-${{ matrix.platform }}-${{ hashFiles('crates/agent-electron-client/package.json') }} | |
| - name: Cache bundled Git (Windows only) | |
| if: matrix.platform == 'windows-latest' | |
| uses: actions/cache@v4 | |
| with: | |
| path: crates/agent-electron-client/resources/git | |
| key: bundled-git-2.47.1-windows-${{ hashFiles('crates/agent-electron-client/package.json') }} | |
| - name: Cache uv | |
| uses: actions/cache@v4 | |
| with: | |
| path: crates/agent-electron-client/resources/uv | |
| key: bundled-uv-${{ matrix.platform }}-${{ hashFiles('crates/agent-electron-client/package.json') }} | |
| - name: Prepare bundled resources (uv, node, git) | |
| working-directory: crates/agent-electron-client | |
| run: npm run prepare:all | |
| timeout-minutes: 15 | |
| - name: Build Electron app (unsigned) | |
| working-directory: crates/agent-electron-client | |
| run: npm run ${{ matrix.dist_cmd }} | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: electron-${{ matrix.artifact_os }}-${{ steps.sha.outputs.short }} | |
| path: crates/agent-electron-client/release/ | |
| retention-days: 7 |