Build and Release #3
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 App | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: '版本号 (例如: v1.0.0)' | |
| required: true | |
| default: 'v1.0.0' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| # Linux x86_64 | |
| - os: ubuntu-22.04 | |
| rust_target: x86_64-unknown-linux-gnu | |
| # macOS Intel | |
| - os: macos-latest | |
| rust_target: x86_64-apple-darwin | |
| # macOS Apple Silicon (ARM64) | |
| - os: macos-latest | |
| rust_target: aarch64-apple-darwin | |
| # Windows x86_64 | |
| - os: windows-latest | |
| rust_target: x86_64-pc-windows-msvc | |
| runs-on: ${{ matrix.platform.os }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies (Ubuntu only) | |
| if: matrix.platform.os == 'ubuntu-22.04' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9.0.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.platform.rust_target }} | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build Tauri app | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} | |
| TAURI_SIGNING_PRIVATE_KEY_PASSWORD: "" | |
| with: | |
| projectPath: desktop | |
| tagName: ${{ github.ref_name }} | |
| releaseName: 'CloudPaste ${{ github.ref_name }}' | |
| releaseBody: | | |
| ## 下载说明 | |
| - **Windows**: 下载 `.msi` 或 `.exe` 安装包 | |
| - **macOS**: 下载 `.dmg` 文件(支持 Intel 和 Apple Silicon) | |
| - **Linux**: 下载 `.AppImage` 或 `.deb` 包 | |
| releaseDraft: false | |
| prerelease: false | |
| args: --target ${{ matrix.platform.rust_target }} | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.platform.os }}-${{ matrix.platform.rust_target }} | |
| path: | | |
| desktop/src-tauri/target/${{ matrix.platform.rust_target }}/release/bundle/ | |
| retention-days: 7 |