From 721c105946a6e1d2df2080743899f6f2c6124719 Mon Sep 17 00:00:00 2001 From: liqi Date: Thu, 11 Dec 2025 10:14:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 113 ++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7bf1ede --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,113 @@ +name: 🧀 打包所有平台 + +on: + # 手动触发 + workflow_dispatch: + # 推送 tag 时触发 + push: + tags: + - 'v*' + +jobs: + build: + strategy: + fail-fast: false # 一个失败不影响其他 + matrix: + include: + # Windows 64位 + - os: windows-latest + platform: win64 + artifact_name: CheeseCloudTools-Windows-x64 + + # macOS Intel (使用 macos-15 替代已废弃的 macos-13) + - os: macos-15 + platform: mac_x64 + artifact_name: CheeseCloudTools-macOS-Intel + + # macOS Apple Silicon + - os: macos-latest + platform: mac_arm64 + artifact_name: CheeseCloudTools-macOS-AppleSilicon + + # Linux 64位 + - os: ubuntu-latest + platform: linux64 + artifact_name: CheeseCloudTools-Linux-x64 + + runs-on: ${{ matrix.os }} + + steps: + - name: 📥 检出代码 + uses: actions/checkout@v4 + + - name: 🐍 设置 Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + architecture: ${{ matrix.python_arch || 'x64' }} + + # Linux 需要安装 Qt 依赖 + - name: 🐧 安装 Linux 依赖 + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y \ + libxcb-xinerama0 \ + libxcb-cursor0 \ + libxkbcommon-x11-0 \ + libxcb-icccm4 \ + libxcb-image0 \ + libxcb-keysyms1 \ + libxcb-randr0 \ + libxcb-render-util0 \ + libxcb-shape0 \ + libegl1 \ + libgl1-mesa-glx \ + libxcb-glx0 \ + libglib2.0-0 \ + libdbus-1-3 + + - name: 📦 安装依赖 + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install pyinstaller + + - name: 🔨 执行打包 + run: python build_app.py --platform ${{ matrix.platform }} + + - name: 📤 上传构建产物 + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.artifact_name }} + path: dist/${{ matrix.platform }}/ + retention-days: 30 + + # 创建 Release(仅在推送 tag 时) + release: + needs: build + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + + steps: + - name: 📥 下载所有构建产物 + uses: actions/download-artifact@v4 + with: + path: artifacts/ + + - name: 📦 打包为 ZIP + run: | + cd artifacts + for dir in */; do + zip -r "${dir%/}.zip" "$dir" + done + + - name: 🚀 创建 Release + uses: softprops/action-gh-release@v1 + with: + files: artifacts/*.zip + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +