更新 .github/workflows/build-exe.yml

This commit is contained in:
miu
2026-03-15 07:09:24 +08:00
Unverified
parent 7fc8240a60
commit de14ff940e

View File

@@ -1,57 +1,28 @@
name: Build Windows EXE name: Build Windows EXE with Full Image
on: on: [push]
push:
branches: ["main"]
workflow_dispatch:
jobs: jobs:
build: build:
runs-on: Ubuntu_docker_act # 使用 Ubuntu 基础镜像 runs-on: Ubuntu_docker_act # 使用我们刚定义的标签
steps: steps:
# 第一步:安装所有需要的环境 - uses: actions/checkout@v4
- name: Install Node.js and Python
# 环境已预装,直接验证
- name: Verify tools
run: | run: |
apt-get update node --version
apt-get install -y curl wget git software-properties-common python --version
wine --version # 确认 wine 是否存在full 镜像很可能包含
# 安装 Node.js 18
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt-get install -y nodejs
# 安装 Python 3.13
add-apt-repository ppa:deadsnakes/ppa -y
apt-get update
apt-get install -y python3.13 python3.13-dev python3.13-distutils
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.13
ln -sf /usr/bin/python3.13 /usr/bin/python
ln -sf /usr/bin/python3.13 /usr/bin/python3
# 安装 Wine (用于Windows交叉编译)
dpkg --add-architecture i386
apt-get update
apt-get install -y wine64 wine32
# 验证安装
echo "Node version: $(node --version)"
echo "Python version: $(python --version)"
echo "Wine version: $(wine --version)"
- name: Checkout code
uses: actions/checkout@v4
# 安装 Python 依赖
- name: Install Python dependencies - name: Install Python dependencies
run: | run: |
python -m pip install --upgrade pip
pip install pyinstaller keyboard pywin32 pip install pyinstaller keyboard pywin32
# 构建 EXE - name: Build EXE
- name: Build EXE with PyInstaller
run: | run: |
# 使用 Wine 运行 PyInstaller 来构建 Windows EXE # 直接在原生环境下运行full 镜像可能无需 wine 包装
wine python -m PyInstaller --onefile --windowed --name Shortcut_Sync_PotPlayer main.py pyinstaller --onefile --windowed --name Shortcut_Sync_PotPlayer main.py
# 上传构建产物
- name: Upload Artifact - name: Upload Artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with: