From 97553407a476ad45f84f59fa2e9ee1357614e256 Mon Sep 17 00:00:00 2001 From: Dawn <2439646234@qq.com> Date: Sun, 5 Jan 2025 18:25:24 +0800 Subject: [PATCH] Test actions (#147) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ci(action): :ferris_wheel: 增加测试分支来测试是否可以正常打包 * fix: :bug: 修复依赖出错 --- .github/workflows/debug-build.yml | 82 +++++++++++++++++++++++++++++++ .github/workflows/release.yml | 15 ++++-- 2 files changed, 93 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/debug-build.yml diff --git a/.github/workflows/debug-build.yml b/.github/workflows/debug-build.yml new file mode 100644 index 00000000..1b1f4200 --- /dev/null +++ b/.github/workflows/debug-build.yml @@ -0,0 +1,82 @@ +name: Debug Build + +on: + workflow_dispatch: # 手动触发 + inputs: + platform: + type: choice + description: '选择测试平台' + required: true + default: 'ubuntu-22.04' + options: + - ubuntu-22.04 + - macos-latest + - windows-latest + +jobs: + debug-build: + runs-on: ${{ inputs.platform }} + steps: + - uses: actions/checkout@v4 + + - name: Install Ubuntu dependencies + if: inputs.platform == 'ubuntu-22.04' + run: | + sudo apt-get update + sudo apt-get install -y \ + libwebkit2gtk-4.1-dev \ + librsvg2-dev \ + patchelf \ + libudev-dev \ + libasound2-dev \ + pkg-config \ + libgtk-3-dev \ + libayatana-appindicator3-dev + + # 验证安装的包 + dpkg -l | grep -E 'webkit|appindicator|rsvg|udev|asound|gtk' + + # 添加环境变量配置 + - name: Set up environment variables + run: echo "${{ secrets.ENV_LOCAL_CONTENT }}" > .env.local + + # 安装 pnpm + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + run_install: false + + # 设置 Node.js + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install + + - name: Build Vite + Tauri + run: pnpm build + + # 安装 Rust + - name: install Rust stable + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ inputs.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} + + - name: Rust cache + uses: swatinem/rust-cache@v2 + with: + workspaces: './src-tauri -> target' + + # 只构建不发布 + - 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: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} + with: + releaseId: "debug-build" \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 250c006e..9f18d4b5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,8 +3,7 @@ name: Release CI on: push: tags: - - 'v*' # 当推送 v 开头的标签时触发 - workflow_dispatch: # 允许手动触发工作流 + - 'v*' concurrency: group: release-${{ github.ref }} @@ -32,10 +31,18 @@ jobs: - uses: actions/checkout@v4 - name: install dependencies (ubuntu only) - if: matrix.platform == 'ubuntu-22.04' # Tauri v2 最低兼容性版本 + if: matrix.platform == 'ubuntu-22.04' run: | sudo apt-get update - sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libudev-dev + sudo apt-get install -y \ + libwebkit2gtk-4.1-dev \ + librsvg2-dev \ + patchelf \ + libudev-dev \ + libasound2-dev \ + pkg-config \ + libgtk-3-dev \ + libayatana-appindicator3-dev # 添加环境变量配置 - name: Set up environment variables