chore(release): 合并 v0.5.1 版本功能 #212
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
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version tag (e.g., v0.2.6)' | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-cli: | |
| name: Build CLI (ifai) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: 'macos-latest' | |
| target: 'aarch64-apple-darwin' | |
| artifact: 'ifai-aarch64-apple-darwin.gz' | |
| - platform: 'macos-latest' | |
| target: 'x86_64-apple-darwin' | |
| artifact: 'ifai-x86_64-apple-darwin.gz' | |
| - platform: 'ubuntu-22.04' | |
| target: 'x86_64-unknown-linux-gnu' | |
| artifact: 'ifai-x86_64-unknown-linux-gnu.gz' | |
| - platform: 'windows-latest' | |
| target: 'x86_64-pc-windows-msvc' | |
| artifact: 'ifai-x86_64-pc-windows-msvc.exe.gz' | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install system dependencies (Ubuntu only) | |
| if: matrix.platform == 'ubuntu-22.04' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev \ | |
| libsoup-3.0-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev pkg-config | |
| - name: Checkout Private Core | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: peterfei/ifainew-core | |
| token: ${{ secrets.GH_PAT }} | |
| path: .ifainew-core-temp | |
| - name: Restore Core Directory Structure | |
| shell: bash | |
| run: | | |
| mv .ifainew-core-temp ../ifainew-core | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Set macOS deployment target | |
| if: startsWith(matrix.platform, 'macos') | |
| shell: bash | |
| run: | | |
| echo "MACOSX_DEPLOYMENT_TARGET=10.15" >> $GITHUB_ENV | |
| - name: Build CLI | |
| shell: bash | |
| run: | | |
| cd src-tauri | |
| # 只构建 CLI 二进制文件 | |
| cargo build --release --bin ifai --target ${{ matrix.target }} | |
| - name: Create archive | |
| shell: bash | |
| run: | | |
| cd src-tauri/target/${{ matrix.target }}/release | |
| if [ "${{ matrix.platform }}" = "windows-latest" ]; then | |
| gzip -c ifai.exe > ifai.exe.gz | |
| mv ifai.exe.gz ${{ matrix.artifact }} | |
| else | |
| gzip -c ifai > ${{ matrix.artifact }} | |
| fi | |
| - name: Upload CLI artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cli-${{ matrix.target }} | |
| path: src-tauri/target/${{ matrix.target }}/release/${{ matrix.artifact }} | |
| release: | |
| needs: build-cli | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: 'macos-latest' | |
| args: '--target aarch64-apple-darwin' | |
| target: 'aarch64-apple-darwin' | |
| - platform: 'macos-latest' | |
| args: '--target x86_64-apple-darwin' | |
| target: 'x86_64-apple-darwin' | |
| - platform: 'ubuntu-22.04' | |
| args: '' | |
| target: 'x86_64-unknown-linux-gnu' | |
| - platform: 'windows-latest' | |
| args: '' | |
| target: 'x86_64-pc-windows-msvc' | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: install dependencies (ubuntu only) | |
| if: matrix.platform == 'ubuntu-22.04' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libsoup-3.0-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev | |
| - name: Checkout Private Core | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: peterfei/ifainew-core # 您的私有核心库 | |
| token: ${{ secrets.GH_PAT }} # 必须在仓库 Secrets 中配置此 Token | |
| path: .ifainew-core-temp # 先下载到当前工作区的临时目录 | |
| - name: Restore Core Directory Structure | |
| shell: bash | |
| run: | | |
| # 将核心库移动到上级目录,以匹配本地开发的相对路径 (../ifainew-core) | |
| mv .ifainew-core-temp ../ifainew-core | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Set macOS deployment target (local LLM requires 10.15+) | |
| if: startsWith(matrix.platform, 'macos') | |
| shell: bash | |
| run: | | |
| echo "MACOSX_DEPLOYMENT_TARGET=10.15" >> $GITHUB_ENV | |
| - name: Install Core Frontend Dependencies | |
| run: | | |
| cd ../ifainew-core/typescript | |
| npm install | |
| - name: Install frontend dependencies | |
| shell: bash | |
| env: | |
| NODE_OPTIONS: '--max-old-space-size=8192' | |
| run: | | |
| rm -rf node_modules package-lock.json | |
| npm install --legacy-peer-deps | |
| - name: Increase Node.js memory limit for build | |
| shell: bash | |
| run: | | |
| echo "NODE_OPTIONS=--max-old-space-size=8192" >> $GITHUB_ENV | |
| echo "APP_EDITION=commercial" >> $GITHUB_ENV | |
| - name: Verify Tauri CLI | |
| run: npx tauri --version | |
| - name: Build Frontend | |
| run: npm run build:commercial | |
| - name: Build the app | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NODE_OPTIONS: '--max-old-space-size=8192' | |
| with: | |
| tagName: ${{ github.ref_name }} | |
| releaseName: 'IfAI v__VERSION__' | |
| releaseBody: 'See the assets to download this version and install.' | |
| releaseDraft: true | |
| prerelease: false | |
| args: ${{ matrix.args }} --features commercial-local-llm | |
| upload-cli-to-release: | |
| name: Upload CLI to Release | |
| needs: [build-cli, release] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Download all CLI artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: cli-* | |
| path: ./artifacts | |
| - name: Display structure of downloaded files | |
| run: ls -R ./artifacts | |
| - name: Upload CLI to Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Find all CLI files and upload to release | |
| for file in ./artifacts/*/*.gz; do | |
| if [ -f "$file" ]; then | |
| echo "Uploading $file" | |
| gh release upload ${{ github.ref_name }} "$file" | |
| fi | |
| done |