|
| 1 | +name: 构建 Tauri 桌面版本 |
| 2 | +on: |
| 3 | + - push |
| 4 | + - workflow_dispatch |
| 5 | + |
| 6 | +jobs: |
| 7 | + clean-pre-release: |
| 8 | + name: 删除预发布版本的构建产物 |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - name: 删除预发布版本的构建产物 |
| 12 | + uses: mknejp/delete-release-assets@v1 |
| 13 | + with: |
| 14 | + token: ${{ github.token }} |
| 15 | + assets: | |
| 16 | + *.* |
| 17 | + tag: ${{ github.ref_name }}-dev |
| 18 | + fail-if-no-assets: false |
| 19 | + fail-if-no-release: false |
| 20 | + build-tauri-desktop: |
| 21 | + name: 构建 Tauri 桌面版本 |
| 22 | + needs: clean-pre-release |
| 23 | + strategy: |
| 24 | + fail-fast: false |
| 25 | + matrix: |
| 26 | + include: |
| 27 | + - platform: ubuntu-latest |
| 28 | + args: "" |
| 29 | + name: linux |
| 30 | + arch: x86_64 |
| 31 | + - platform: windows-latest |
| 32 | + args: "" |
| 33 | + name: windows |
| 34 | + arch: x86_64 |
| 35 | + - platform: macos-latest # arm64 二进制包 |
| 36 | + args: "--target aarch64-apple-darwin" |
| 37 | + name: macOS |
| 38 | + arch: aarch64 |
| 39 | + - platform: macos-latest # x86 二进制包 |
| 40 | + args: "--target x86_64-apple-darwin" |
| 41 | + name: macOS |
| 42 | + arch: x86_64 |
| 43 | + - platform: macos-latest # 通用二进制包 |
| 44 | + args: "--target universal-apple-darwin" |
| 45 | + name: macOS |
| 46 | + arch: universal |
| 47 | + |
| 48 | + runs-on: ${{ matrix.platform }} |
| 49 | + steps: |
| 50 | + - name: 克隆仓库 |
| 51 | + uses: actions/checkout@v6 |
| 52 | + |
| 53 | + - name: 缓存 Rust 依赖 |
| 54 | + uses: Swatinem/rust-cache@v2 |
| 55 | + with: |
| 56 | + workspaces: ./src-tauri -> target |
| 57 | + |
| 58 | + - name: 安装 PNPM |
| 59 | + uses: pnpm/action-setup@v4 |
| 60 | + |
| 61 | + - name: 安装 Node.js |
| 62 | + uses: actions/setup-node@v6 |
| 63 | + with: |
| 64 | + node-version: lts/* |
| 65 | + cache: pnpm |
| 66 | + |
| 67 | + - name: 安装 Rust 工具链 |
| 68 | + uses: dtolnay/rust-toolchain@stable |
| 69 | + with: |
| 70 | + targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} |
| 71 | + |
| 72 | + # - name: 安装 wasm32 目标 |
| 73 | + # run: rustup target add wasm32-unknown-unknown |
| 74 | + |
| 75 | + # macOS 自带的 Xcode LLVM 不支持 WASM 目标 |
| 76 | + - name: "macOS: 安装 LLVM 和 Clang" |
| 77 | + uses: KyleMayes/install-llvm-action@v2 |
| 78 | + if: matrix.platform == 'macos-latest' |
| 79 | + with: |
| 80 | + version: "15" |
| 81 | + |
| 82 | + - name: 安装 Tauri 所需系统依赖(仅 Linux) |
| 83 | + if: matrix.platform == 'ubuntu-latest' |
| 84 | + run: | |
| 85 | + sudo apt-get update |
| 86 | + sudo apt-get install -y libasound2-dev libappindicator3-dev libwebkit2gtk-4.1-dev librsvg2-dev patchelf |
| 87 | +
|
| 88 | + - name: 安装前端依赖 |
| 89 | + run: pnpm i |
| 90 | + |
| 91 | + - name: 构建 AMLL Editor 程序并发布自动构建 |
| 92 | + uses: tauri-apps/tauri-action@v0 |
| 93 | + with: |
| 94 | + tagName: ${{ github.ref_name }}-dev |
| 95 | + includeUpdaterJson: true |
| 96 | + releaseName: AMLL Editor ${{ github.ref_name }} branch development build |
| 97 | + releaseBody: | |
| 98 | + Latest ${{ github.ref_name }} branch development build. |
| 99 | + 最新 ${{ github.ref_name }} 分支开发调试构建。 |
| 100 | + Development version may be unstable and may not work properly, please only for test purpose. |
| 101 | + 开发版本可能不稳定且可能无法正常工作,请仅用于测试目的。 |
| 102 | +
|
| 103 | + Latest commits (最新提交): ${{ github.event.head_commit.message }} |
| 104 | + prerelease: true |
| 105 | + args: ${{ matrix.args }} |
| 106 | + env: |
| 107 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 108 | + |
| 109 | + - name: 上传产物到 Action Artifact |
| 110 | + uses: actions/upload-artifact@v6 |
| 111 | + with: |
| 112 | + name: AMLL Editor ${{matrix.name}}-${{matrix.arch}} |
| 113 | + path: | |
| 114 | + src-tauri/target/**/release/bundle/**/* |
| 115 | + src-tauri/target/**/release/amll-editor.exe |
| 116 | + src-tauri/target/**/release/amll-editor |
0 commit comments