初始化
This commit is contained in:
97
.github/workflows/build.yml
vendored
Normal file
97
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
name: 🧀 打包所有平台
|
||||
|
||||
on:
|
||||
# 手动触发
|
||||
workflow_dispatch:
|
||||
# 推送 tag 时触发
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
# Windows 64位
|
||||
- os: windows-latest
|
||||
platform: win64
|
||||
artifact_name: CheeseCloudTools-Windows-x64
|
||||
|
||||
# Windows 32位 (使用 32位 Python)
|
||||
# - os: windows-latest
|
||||
# platform: win32
|
||||
# artifact_name: CheeseCloudTools-Windows-x86
|
||||
# python_arch: x86
|
||||
|
||||
# macOS Intel
|
||||
- os: macos-13
|
||||
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' }}
|
||||
|
||||
- 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