Repository navigation
feat: v1.1.3 多 LLM Provider 支持系统 #24
Workflow file for this run
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
| # ============================================================ | |
| # CodeCraft 自动发布工作流 | |
| # 触发条件:推送 v* 标签(如 v1.0.6) | |
| # 自动构建 Win/Mac/Linux 三平台产物并创建 GitHub Release | |
| # ============================================================ | |
| name: Build & Release | |
| on: | |
| push: | |
| tags: ['v*'] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: '版本号(如 1.0.6,不填则使用 tag)' | |
| required: false | |
| permissions: | |
| contents: write | |
| jobs: | |
| # ==================== Windows 构建 ==================== | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - name: 拉取代码 | |
| uses: actions/checkout@v4 | |
| - name: 提取版本号 | |
| id: version | |
| shell: bash | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ inputs.version }}" ]; then | |
| VER="${{ inputs.version }}" | |
| else | |
| VER="${GITHUB_REF#refs/tags/v}" | |
| fi | |
| echo "version=$VER" >> $GITHUB_OUTPUT | |
| echo "📦 版本: $VER" | |
| - name: 设置 JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: 设置 Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: 同步版本号 | |
| shell: bash | |
| run: bash scripts/sync-version.sh "${{ steps.version.outputs.version }}" | |
| - name: Maven 构建 | |
| run: mvn clean package -DskipTests -B | |
| - name: jlink 裁剪 JRE | |
| shell: cmd | |
| run: | | |
| if not exist "electron\jre\bin\java.exe" ( | |
| echo 正在裁剪 JRE... | |
| "%JAVA_HOME%\bin\jlink.exe" ^ | |
| --add-modules java.base,java.logging,java.sql,java.xml,java.naming,java.management,java.instrument,java.security.jgss,java.net.http,jdk.unsupported,java.scripting,java.compiler,java.desktop,jdk.crypto.cryptoki,jdk.security.auth,java.transaction.xa,java.rmi,java.management.rmi ^ | |
| --strip-debug --compress 2 --no-header-files --no-man-pages ^ | |
| --output electron\jre | |
| ) else ( | |
| echo 内置 JRE 已存在,跳过 | |
| ) | |
| - name: Electron 打包 (Windows) | |
| run: | | |
| cd electron | |
| npm install | |
| npx electron-builder --win | |
| env: | |
| ELECTRON_MIRROR: https://npmmirror.com/mirrors/electron/ | |
| - name: 上传产物 (Windows) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-installer | |
| path: electron/release/CodeCraft*Setup*.exe | |
| if-no-files-found: error | |
| # ==================== macOS 构建 ==================== | |
| build-macos: | |
| runs-on: macos-latest | |
| steps: | |
| - name: 拉取代码 | |
| uses: actions/checkout@v4 | |
| - name: 提取版本号 | |
| id: version | |
| shell: bash | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ inputs.version }}" ]; then | |
| VER="${{ inputs.version }}" | |
| else | |
| VER="${GITHUB_REF#refs/tags/v}" | |
| fi | |
| echo "version=$VER" >> $GITHUB_OUTPUT | |
| echo "📦 版本: $VER" | |
| - name: 设置 JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: 设置 Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: 同步版本号 | |
| run: bash scripts/sync-version.sh "${{ steps.version.outputs.version }}" | |
| - name: Maven 构建 | |
| run: mvn clean package -DskipTests -B | |
| - name: jlink 裁剪 JRE (macOS) | |
| run: | | |
| # 强制重新裁剪 JRE(确保是 macOS 版本,而非其他平台残留) | |
| rm -rf electron/jre | |
| echo "正在裁剪 JRE (JAVA_HOME=$JAVA_HOME)..." | |
| "$JAVA_HOME/bin/jlink" \ | |
| --add-modules java.base,java.logging,java.sql,java.xml,java.naming,java.management,java.instrument,java.security.jgss,java.net.http,jdk.unsupported,java.scripting,java.compiler,java.desktop,jdk.crypto.cryptoki,jdk.security.auth,java.transaction.xa,java.rmi,java.management.rmi \ | |
| --strip-debug --compress 2 --no-header-files --no-man-pages \ | |
| --output electron/jre | |
| # 确保 JRE 中所有可执行文件有正确的执行权限 | |
| chmod +x electron/jre/bin/java | |
| chmod +x electron/jre/lib/jspawnhelper 2>/dev/null || true | |
| echo "✅ JRE 裁剪完成" | |
| ls -lh electron/jre/bin/java | |
| - name: 生成 macOS 图标 | |
| run: | | |
| if [ ! -f "electron/icon.icns" ]; then | |
| echo "正在生成 icon.icns..." | |
| ICONSET="$(mktemp -d)/icon.iconset" | |
| mkdir -p "$ICONSET" | |
| sips -z 16 16 electron/icon.png --out "$ICONSET/icon_16x16.png" || true | |
| sips -z 32 32 electron/icon.png --out "$ICONSET/icon_16x16@2x.png" || true | |
| sips -z 32 32 electron/icon.png --out "$ICONSET/icon_32x32.png" || true | |
| sips -z 64 64 electron/icon.png --out "$ICONSET/icon_32x32@2x.png" || true | |
| sips -z 128 128 electron/icon.png --out "$ICONSET/icon_128x128.png" || true | |
| sips -z 256 256 electron/icon.png --out "$ICONSET/icon_128x128@2x.png" || true | |
| sips -z 256 256 electron/icon.png --out "$ICONSET/icon_256x256.png" || true | |
| sips -z 512 512 electron/icon.png --out "$ICONSET/icon_256x256@2x.png" || true | |
| sips -z 512 512 electron/icon.png --out "$ICONSET/icon_512x512.png" || true | |
| sips -z 1024 1024 electron/icon.png --out "$ICONSET/icon_512x512@2x.png" || true | |
| iconutil -c icns "$ICONSET" -o electron/icon.icns 2>/dev/null || echo "⚠️ iconutil failed, skipping icns" | |
| rm -rf "$(dirname "$ICONSET")" | |
| ls -lh electron/icon.icns 2>/dev/null || echo "⚠️ icon.icns not generated" | |
| else | |
| echo "icon.icns 已存在,跳过" | |
| fi | |
| - name: 安装 Electron 依赖 (macOS) | |
| run: | | |
| cd electron | |
| npm ci 2>/dev/null || npm install | |
| env: | |
| ELECTRON_MIRROR: https://npmmirror.com/mirrors/electron/ | |
| - name: Electron 打包 (macOS) | |
| run: | | |
| cd electron | |
| npx electron-builder --mac | |
| env: | |
| ELECTRON_MIRROR: https://npmmirror.com/mirrors/electron/ | |
| - name: Ad-hoc 签名及验证 (macOS) | |
| run: | | |
| echo "对 .app 进行 ad-hoc 签名..." | |
| APP_PATH=$(find electron/release/mac* -name "CodeCraft.app" -type d 2>/dev/null | head -1) | |
| if [ -n "$APP_PATH" ]; then | |
| echo "找到应用: $APP_PATH" | |
| # 先对 JRE 中的可执行文件和 dylib 进行签名 | |
| find "$APP_PATH/Contents/Resources/jre" -type f \( -perm +111 -o -name "*.dylib" -o -name "*.jnilib" \) 2>/dev/null | while read f; do | |
| codesign --force --deep --sign - --timestamp=none "$f" 2>/dev/null || true | |
| done | |
| # 对整个 .app 进行 ad-hoc 签名 | |
| codesign --force --deep --sign - --timestamp=none "$APP_PATH" 2>/dev/null || true | |
| echo "✅ Ad-hoc 签名完成" | |
| # 验证签名 | |
| codesign --verify --deep --strict --verbose=2 "$APP_PATH" 2>&1 || echo "⚠️ 签名验证警告(ad-hoc 签名预期会显示未公证)" | |
| else | |
| echo "⚠️ 未找到 .app,跳过签名" | |
| fi | |
| - name: 上传产物 (macOS) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-installer | |
| path: electron/release/CodeCraft-*.dmg | |
| if-no-files-found: error | |
| # ==================== Linux 构建 ==================== | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 拉取代码 | |
| uses: actions/checkout@v4 | |
| - name: 提取版本号 | |
| id: version | |
| shell: bash | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ inputs.version }}" ]; then | |
| VER="${{ inputs.version }}" | |
| else | |
| VER="${GITHUB_REF#refs/tags/v}" | |
| fi | |
| echo "version=$VER" >> $GITHUB_OUTPUT | |
| echo "📦 版本: $VER" | |
| - name: 设置 JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: 设置 Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: 同步版本号 | |
| run: bash scripts/sync-version.sh "${{ steps.version.outputs.version }}" | |
| - name: Maven 构建 | |
| run: mvn clean package -DskipTests -B | |
| - name: jlink 裁剪 JRE | |
| run: | | |
| if [ ! -d "electron/jre/bin" ]; then | |
| echo "正在裁剪 JRE..." | |
| "$JAVA_HOME/bin/jlink" \ | |
| --add-modules java.base,java.logging,java.sql,java.xml,java.naming,java.management,java.instrument,java.security.jgss,java.net.http,jdk.unsupported,java.scripting,java.compiler,java.desktop,jdk.crypto.cryptoki,jdk.security.auth,java.transaction.xa,java.rmi,java.management.rmi \ | |
| --strip-debug --compress 2 --no-header-files --no-man-pages \ | |
| --output electron/jre | |
| else | |
| echo "内置 JRE 已存在,跳过" | |
| fi | |
| - name: 安装 Linux 构建依赖 | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y -qq libfuse2 rpm 2>/dev/null || true | |
| echo "✅ 系统依赖已就绪" | |
| - name: 验证构建产物 | |
| run: | | |
| echo "=== JAR 文件 ===" | |
| ls -lh target/*.jar 2>/dev/null || echo "❌ JAR 未找到" | |
| echo "=== electron/ 目录 ===" | |
| ls -lh electron/ 2>/dev/null || echo "❌ electron/ 不存在" | |
| echo "=== JRE ===" | |
| ls -lh electron/jre/bin/java 2>/dev/null || echo "⚠️ JRE 未裁剪" | |
| - name: 安装 Electron 依赖 (Linux) | |
| run: | | |
| cd electron | |
| npm ci 2>/dev/null || npm install | |
| env: | |
| ELECTRON_MIRROR: https://npmmirror.com/mirrors/electron/ | |
| - name: Electron 打包 (Linux) | |
| run: | | |
| cd electron | |
| npx electron-builder --linux | |
| env: | |
| ELECTRON_MIRROR: https://npmmirror.com/mirrors/electron/ | |
| - name: 上传产物 (Linux) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-installer | |
| path: | | |
| electron/release/CodeCraft-*.AppImage | |
| electron/release/CodeCraft-*.deb | |
| if-no-files-found: error | |
| # ==================== 创建 Release ==================== | |
| create-release: | |
| needs: [build-windows, build-macos, build-linux] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 提取版本号 | |
| id: version | |
| run: | | |
| VER="${GITHUB_REF#refs/tags/v}" | |
| echo "version=$VER" >> $GITHUB_OUTPUT | |
| - name: 下载全部产物 | |
| uses: actions/download-artifact@v4 | |
| - name: 列出产物 | |
| run: | | |
| echo "=== 所有产物 ===" | |
| find . -type f \( -name "*.exe" -o -name "*.dmg" -o -name "*.AppImage" -o -name "*.deb" \) -exec ls -lh {} \; | |
| - name: 创建 GitHub Release 并上传产物 | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: "CodeCraft v${{ steps.version.outputs.version }}" | |
| body: | | |
| ## 🚀 CodeCraft v${{ steps.version.outputs.version }} | |
| ### 📥 下载 | |
| - **Windows**:下载 `CodeCraft-Setup-${{ steps.version.outputs.version }}.exe` 双击安装 | |
| - **macOS**:下载 `CodeCraft-${{ steps.version.outputs.version }}.dmg` 拖入 Applications,**首次打开请右键 → 打开**(见下方说明) | |
| - **Linux**:下载 `.AppImage` 或 `.deb` | |
| ### 🍎 macOS 用户必读 | |
| 由于未使用 Apple 付费开发者证书($99/年),首次打开时会提示「无法验证开发者」。 | |
| 请按以下步骤操作: | |
| 1. 将 `CodeCraft.app` 拖入 `Applications` 文件夹 | |
| 2. **右键(或 Control+点击)→ 打开** | |
| 3. 在弹出的对话框中点击「打开」 | |
| 4. 之后再打开只需双击即可 | |
| 或者终端执行: | |
| ``` | |
| xattr -cr /Applications/CodeCraft.app | |
| ``` | |
| ### 💡 说明 | |
| - 安装包自带 JRE 运行环境,无需安装 Java | |
| - 首次使用请在「配置」页面设置 DeepSeek API Key | |
| - 支持 Intel 和 Apple Silicon (M1/M2/M3) Mac | |
| > 📝 完整变更见 [CHANGELOG.md](${{ github.server_url }}/${{ github.repository }}/blob/main/CHANGELOG.md) | |
| files: | | |
| windows-installer/CodeCraft*Setup*.exe | |
| macos-installer/*.dmg | |
| linux-installer/*.AppImage | |
| linux-installer/*.deb | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |