feat: 新增Toast消息组件并优化校对功能 #34
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: Build Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: macos-latest | |
| target: aarch64-apple-darwin | |
| - platform: macos-latest | |
| target: x86_64-apple-darwin | |
| - platform: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| - platform: windows-latest | |
| target: aarch64-pc-windows-msvc # Windows ARM64 | |
| - platform: ubuntu-22.04 | |
| target: x86_64-unknown-linux-gnu | |
| # Android构建配置 - 使用Ubuntu 22.04 (最新可用版本) | |
| - platform: ubuntu-22.04 | |
| target: aarch64-linux-android # ARM v8 (64-bit) | |
| android: true | |
| android_arch: aarch64 | |
| - platform: ubuntu-22.04 | |
| target: armv7-linux-androideabi # ARM v7 (32-bit) | |
| android: true | |
| android_arch: armv7 | |
| - platform: ubuntu-22.04 | |
| target: x86_64-linux-android # x86_64 (64-bit Intel/AMD) | |
| android: true | |
| android_arch: x86_64 | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' # 更新到Node.js 24 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v6 | |
| with: | |
| version: 9 | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| # 移除 targets 参数,因为在条件步骤中添加目标 | |
| # Windows特定配置 | |
| - name: Install Windows targets and tools | |
| if: matrix.platform == 'windows-latest' | |
| run: | | |
| rustup target add ${{ matrix.target }} | |
| choco install nuget.commandline | |
| shell: powershell | |
| # Android特定配置 | |
| - name: Install Android targets | |
| if: matrix.android | |
| run: | | |
| rustup target add ${{ matrix.target }} | |
| # 为Android构建添加通用的目标平台 | |
| rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android | |
| # 修复非Android构建时错误添加Android目标的问题 | |
| - name: Install non-Android targets | |
| if: "!matrix.android" | |
| run: | | |
| rustup target add ${{ matrix.target }} | |
| # Android特定:安装Java 17 | |
| - name: Setup Java for Android | |
| if: matrix.android | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Setup Android SDK | |
| if: matrix.android | |
| uses: android-actions/setup-android@v4 | |
| with: | |
| packages: > | |
| platform-tools | |
| platforms;android-34 | |
| build-tools;34.0.0 | |
| cmdline-tools;latest | |
| ndk;25.1.8937393 | |
| accept-android-sdk-licenses: true | |
| - name: Install Android dependencies (if building for Android) | |
| if: matrix.android | |
| run: | | |
| echo "Installing Android dependencies" | |
| cargo install cargo-ndk | |
| cargo install tauri-cli | |
| - name: Install Linux dependencies (Ubuntu only) | |
| if: matrix.platform == 'ubuntu-22.04' && !matrix.android | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libgtk-3-dev | |
| # Android构建需要的Linux依赖 | |
| - name: Install Android Linux dependencies | |
| if: matrix.android | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y openjdk-17-jdk libc6-dev libstdc++-10-dev | |
| - name: Install frontend dependencies | |
| run: pnpm install | |
| # Android构建步骤 | |
| - name: Initialize Android project | |
| if: matrix.android | |
| run: | | |
| cd src-tauri | |
| cargo tauri android init | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAURI_ANDROID_MIN_SDK_VERSION: 24 | |
| - name: Build Tauri app for Android | |
| if: matrix.android | |
| run: | | |
| cd src-tauri | |
| cargo tauri android build --target ${{ matrix.android_arch }} | |
| # 重命名 APK 和 AAB 文件 | |
| VERSION=$(cat Cargo.toml | grep 'version =' | head -n1 | sed 's/version = "\(.*\)"/\1/') | |
| APP_NAME="ProofReader" | |
| # 重命名 APK (release 版本) | |
| find gen/android/app/build/outputs/apk/release -name "*.apk" 2>/dev/null | while read apk; do | |
| mv "$apk" "gen/android/app/build/outputs/apk/release/${APP_NAME}-v${VERSION}-${{ matrix.android_arch }}.apk" | |
| done | |
| # 重命名 AAB (release 版本) | |
| find gen/android/app/build/outputs/bundle/release -name "*.aab" 2>/dev/null | while read aab; do | |
| mv "$aab" "gen/android/app/build/outputs/bundle/release/${APP_NAME}-v${VERSION}-${{ matrix.android_arch }}.aab" | |
| done | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAURI_ANDROID_MIN_SDK_VERSION: 24 | |
| # 非Android构建步骤 | |
| - name: Build Tauri app for desktop | |
| if: "!matrix.android" | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| args: --target ${{ matrix.target }} | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: release-${{ matrix.target }} | |
| path: | | |
| src-tauri/target/${{ matrix.target }}/release/bundle/**/*.dmg | |
| src-tauri/target/${{ matrix.target }}/release/bundle/**/*.app | |
| src-tauri/target/${{ matrix.target }}/release/bundle/**/*.msi | |
| src-tauri/target/${{ matrix.target }}/release/bundle/**/*.exe | |
| src-tauri/target/${{ matrix.target }}/release/bundle/**/*.deb | |
| src-tauri/target/${{ matrix.target }}/release/bundle/**/*.AppImage | |
| src-tauri/gen/android/app/build/outputs/apk/**/* | |
| src-tauri/gen/android/app/build/outputs/bundle/**/* | |
| retention-days: 7 | |
| compression-level: 0 | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: List files to upload | |
| run: find artifacts -type f -name "*.dmg" -o -name "*.exe" -o -name "*.msi" -o -name "*.apk" -o -name "*.aab" -o -name "*.deb" -o -name "*.AppImage" | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| draft: true | |
| files: | | |
| artifacts/**/*.dmg | |
| artifacts/**/*.exe | |
| artifacts/**/*.msi | |
| artifacts/**/*.apk | |
| artifacts/**/*.aab | |
| artifacts/**/*.deb | |
| artifacts/**/*.AppImage | |
| generate_release_notes: true |