Files
晨叶梦春 600ba5cfa7 feat: improve types & menus
Signed-off-by: 晨叶梦春 <wuziqian211@126.com>
2026-08-01 01:08:04 +08:00

85 lines
2.5 KiB
YAML

name: Build & Release
permissions:
contents: write
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
required: true
type: string
jobs:
build:
name: Build ${{ matrix.name }} App
runs-on: ${{ matrix.os }}
strategy:
# 不要因为某一个平台构建失败就取消其余平台的构建
fail-fast: false
matrix:
include:
- name: Windows x64
os: windows-latest
binary: tchMaterial-parser.exe
asset: tchMaterial-parser-windows-x64.exe
- name: Windows Arm64
os: windows-11-arm
binary: tchMaterial-parser.exe
asset: tchMaterial-parser-windows-arm64.exe
- name: Linux x64
os: ubuntu-latest
binary: tchMaterial-parser
asset: tchMaterial-parser-linux-x64
- name: Linux Arm64
os: ubuntu-24.04-arm
binary: tchMaterial-parser
asset: tchMaterial-parser-linux-arm64
- name: macOS x64
os: macos-26-intel
binary: tchMaterial-parser.app
asset: tchMaterial-parser-mac-x64.zip
- name: macOS Arm64
os: macos-latest
binary: tchMaterial-parser.app
asset: tchMaterial-parser-mac-arm64.zip
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install .
- name: Build app with PyInstaller
run: pyinstaller ./tchMaterial-parser.spec
# Windows 与 Linux 构建出的是单个可执行文件,改名后直接上传
- name: Pack app (Windows / Linux)
if: runner.os != 'macOS'
shell: bash
run: mv "dist/${{ matrix.binary }}" "dist/${{ matrix.asset }}"
# macOS 构建出的是 .app 应用包(一个目录),需用 ditto 打包为 zip 以保留资源分支与权限
- name: Pack app (macOS)
if: runner.os == 'macOS'
run: /usr/bin/ditto -c -k --keepParent -rsrc "dist/${{ matrix.binary }}" "dist/${{ matrix.asset }}"
- name: Upload Release Asset
uses: softprops/action-gh-release@v2
with:
files: dist/${{ matrix.asset }}
tag_name: ${{ inputs.tag || github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}