初始化
This commit is contained in:
113
.github/workflows/build.yml
vendored
Normal file
113
.github/workflows/build.yml
vendored
Normal file
@@ -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 }}
|
||||
|
||||
Reference in New Issue
Block a user