🐛 修復工作流程

This commit is contained in:
Minidoracat 2025-06-15 18:23:55 +08:00
parent 94aa415648
commit 0008df8065

View File

@ -45,44 +45,65 @@ jobs:
target: x86_64-pc-windows-msvc target: x86_64-pc-windows-msvc
binary: mcp-feedback-enhanced-desktop.exe binary: mcp-feedback-enhanced-desktop.exe
name: windows name: windows
enabled: ${{ github.event.inputs.platforms == 'all' || github.event.inputs.platforms == 'windows' || github.event.inputs.platforms == '' }}
- os: macos-latest - os: macos-latest
target: x86_64-apple-darwin target: x86_64-apple-darwin
binary: mcp-feedback-enhanced-desktop binary: mcp-feedback-enhanced-desktop
name: macos-intel name: macos-intel
enabled: ${{ github.event.inputs.platforms == 'all' || github.event.inputs.platforms == 'macos' || github.event.inputs.platforms == '' }}
- os: macos-latest - os: macos-latest
target: aarch64-apple-darwin target: aarch64-apple-darwin
binary: mcp-feedback-enhanced-desktop binary: mcp-feedback-enhanced-desktop
name: macos-arm64 name: macos-arm64
enabled: ${{ github.event.inputs.platforms == 'all' || github.event.inputs.platforms == 'macos' || github.event.inputs.platforms == '' }}
- os: ubuntu-latest - os: ubuntu-latest
target: x86_64-unknown-linux-gnu target: x86_64-unknown-linux-gnu
binary: mcp-feedback-enhanced-desktop binary: mcp-feedback-enhanced-desktop
name: linux name: linux
enabled: ${{ github.event.inputs.platforms == 'all' || github.event.inputs.platforms == 'linux' || github.event.inputs.platforms == '' }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
if: ${{ matrix.enabled != 'false' }}
steps: steps:
- name: Check if platform should be built
id: check_platform
run: |
SHOULD_BUILD="false"
PLATFORM_INPUT="${{ github.event.inputs.platforms }}"
MATRIX_NAME="${{ matrix.name }}"
# 檢查是否應該構建此平台
if [ "$PLATFORM_INPUT" = "all" ] || [ "$PLATFORM_INPUT" = "" ]; then
SHOULD_BUILD="true"
elif [ "$PLATFORM_INPUT" = "windows" ] && [ "$MATRIX_NAME" = "windows" ]; then
SHOULD_BUILD="true"
elif [ "$PLATFORM_INPUT" = "macos" ] && ([ "$MATRIX_NAME" = "macos-intel" ] || [ "$MATRIX_NAME" = "macos-arm64" ]); then
SHOULD_BUILD="true"
elif [ "$PLATFORM_INPUT" = "linux" ] && [ "$MATRIX_NAME" = "linux" ]; then
SHOULD_BUILD="true"
fi
echo "should_build=$SHOULD_BUILD" >> $GITHUB_OUTPUT
echo "Platform: $MATRIX_NAME, Input: $PLATFORM_INPUT, Should build: $SHOULD_BUILD"
- name: Checkout code - name: Checkout code
if: steps.check_platform.outputs.should_build == 'true'
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install Rust - name: Install Rust
if: steps.check_platform.outputs.should_build == 'true'
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
targets: ${{ matrix.target }} targets: ${{ matrix.target }}
- name: Install uv - name: Install uv
if: steps.check_platform.outputs.should_build == 'true'
uses: astral-sh/setup-uv@v4 uses: astral-sh/setup-uv@v4
with: with:
version: "latest" version: "latest"
- name: Set up Python - name: Set up Python
if: steps.check_platform.outputs.should_build == 'true'
run: uv python install run: uv python install
- name: Install dependencies - name: Install dependencies
if: steps.check_platform.outputs.should_build == 'true'
run: uv sync --dev run: uv sync --dev
- name: Cache Rust dependencies - name: Cache Rust dependencies
@ -98,7 +119,7 @@ jobs:
${{ runner.os }}-cargo- ${{ runner.os }}-cargo-
- name: Install platform-specific dependencies (Linux) - name: Install platform-specific dependencies (Linux)
if: matrix.os == 'ubuntu-latest' if: ${{ steps.check_platform.outputs.should_build == 'true' && matrix.os == 'ubuntu-latest' }}
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y \ sudo apt-get install -y \
@ -110,6 +131,7 @@ jobs:
libayatana-appindicator3-dev libayatana-appindicator3-dev
- name: Build desktop application for ${{ matrix.name }} - name: Build desktop application for ${{ matrix.name }}
if: steps.check_platform.outputs.should_build == 'true'
run: | run: |
cd src-tauri cd src-tauri
echo "🔨 開始構建 ${{ matrix.name }} (${{ matrix.target }})..." echo "🔨 開始構建 ${{ matrix.name }} (${{ matrix.target }})..."
@ -117,6 +139,7 @@ jobs:
echo "✅ 構建完成" echo "✅ 構建完成"
- name: Verify build output - name: Verify build output
if: steps.check_platform.outputs.should_build == 'true'
run: | run: |
echo "🔍 檢查構建產物..." echo "🔍 檢查構建產物..."
BINARY_PATH="src-tauri/target/${{ matrix.target }}/release/${{ matrix.binary }}" BINARY_PATH="src-tauri/target/${{ matrix.target }}/release/${{ matrix.binary }}"
@ -142,7 +165,7 @@ jobs:
shell: bash shell: bash
- name: Upload desktop binary - name: Upload desktop binary
if: ${{ github.event.inputs.upload_artifacts != 'false' }} if: ${{ steps.check_platform.outputs.should_build == 'true' && github.event.inputs.upload_artifacts != 'false' }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: desktop-${{ matrix.name }} name: desktop-${{ matrix.name }}