From 108a599666a30d7111dace27ee8bf63c47a116c2 Mon Sep 17 00:00:00 2001 From: Tunglies <77394545+Tunglies@users.noreply.github.com> Date: Mon, 14 Jul 2025 20:07:18 +0800 Subject: [PATCH] fix: add platform input options for workflow dispatch in dev.yml --- .github/workflows/dev.yml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 53b771cc..8d7dba20 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -2,12 +2,17 @@ name: Development Test on: workflow_dispatch: + inputs: + platforms: + description: "选择要运行的平台(逗号分隔,如 windows,macos-aarch64,macos-x86_64)" + required: false + default: "windows,macos-aarch64,macos-x86_64" + permissions: write-all env: CARGO_INCREMENTAL: 0 RUST_BACKTRACE: short concurrency: - # only allow per workflow per commit (and not pr) to run at a time group: "${{ github.workflow }} - ${{ github.head_ref || github.ref }}" cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} @@ -20,46 +25,57 @@ jobs: - os: windows-latest target: x86_64-pc-windows-msvc bundle: nsis + id: windows - os: macos-latest target: aarch64-apple-darwin bundle: dmg + id: macos-aarch64 - os: macos-latest target: x86_64-apple-darwin bundle: dmg + id: macos-x86_64 runs-on: ${{ matrix.os }} steps: - name: Checkout Repository + if: contains(github.event.inputs.platforms || 'windows,macos-aarch64,macos-x86_64', matrix.id) uses: actions/checkout@v4 - name: Install Rust Stable + if: contains(github.event.inputs.platforms || 'windows,macos-aarch64,macos-x86_64', matrix.id) uses: dtolnay/rust-toolchain@stable - name: Add Rust Target + if: contains(github.event.inputs.platforms || 'windows,macos-aarch64,macos-x86_64', matrix.id) run: rustup target add ${{ matrix.target }} - name: Rust Cache + if: contains(github.event.inputs.platforms || 'windows,macos-aarch64,macos-x86_64', matrix.id) uses: Swatinem/rust-cache@v2 with: workspaces: src-tauri save-if: false - name: Install Node + if: contains(github.event.inputs.platforms || 'windows,macos-aarch64,macos-x86_64', matrix.id) uses: actions/setup-node@v4 with: node-version: "20" - uses: pnpm/action-setup@v4 name: Install pnpm + if: contains(github.event.inputs.platforms || 'windows,macos-aarch64,macos-x86_64', matrix.id) with: run_install: false - name: Pnpm install and check + if: contains(github.event.inputs.platforms || 'windows,macos-aarch64,macos-x86_64', matrix.id) run: | pnpm i pnpm run prebuild ${{ matrix.target }} - name: Tauri build + if: contains(github.event.inputs.platforms || 'windows,macos-aarch64,macos-x86_64', matrix.id) uses: tauri-apps/tauri-action@v0 env: NODE_OPTIONS: "--max_old_space_size=4096" @@ -77,7 +93,7 @@ jobs: args: --target ${{ matrix.target }} -b ${{ matrix.bundle }} - name: Upload Artifacts - if: matrix.os == 'macos-latest' + if: matrix.os == 'macos-latest' && contains(github.event.inputs.platforms || 'windows,macos-aarch64,macos-x86_64', matrix.id) uses: actions/upload-artifact@v4 with: name: ${{ matrix.target }} @@ -85,7 +101,7 @@ jobs: if-no-files-found: error - name: Upload Artifacts - if: matrix.os == 'windows-latest' + if: matrix.os == 'windows-latest' && contains(github.event.inputs.platforms || 'windows,macos-aarch64,macos-x86_64', matrix.id) uses: actions/upload-artifact@v4 with: name: ${{ matrix.target }}