forked from Xingshu/Shortcut_Sync_PotPlayer
Compare commits
9 Commits
miu-patch-
...
v1.0
105
.github/workflows/build-exe.yml
vendored
105
.github/workflows/build-exe.yml
vendored
@@ -7,32 +7,103 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Wine
|
# 步骤1:下载 Python 3.9.9 安装包(保持文件名一致)
|
||||||
|
- name: Download Python 3.9.9 installer
|
||||||
run: |
|
run: |
|
||||||
sudo dpkg --add-architecture i386
|
wget https://mirrors.tuna.tsinghua.edu.cn/python/3.9.9/python-3.9.9-amd64.exe
|
||||||
sudo apt-get update
|
ls -lh python-3.9.9-amd64.exe
|
||||||
sudo apt-get install -y wine64 wine32
|
# 验证文件完整性
|
||||||
wine --version # 安装后验证
|
file python-3.9.9-amd64.exe
|
||||||
|
|
||||||
- name: Install Windows dependencies using Wine Python
|
- name: Reset Wine environment (clean slate)
|
||||||
run: |
|
run: |
|
||||||
# 使用 Wine 运行 Windows 版本的 Python
|
echo "=== 备份并删除旧的 Wine 配置目录 ==="
|
||||||
wine python -m pip install --upgrade pip
|
# 如果 ~/.wine 目录存在,先重命名备份(或直接删除)
|
||||||
wine python -m pip install pyinstaller keyboard pywin32
|
if [ -d "$HOME/.wine" ]; then
|
||||||
|
mv "$HOME/.wine" "$HOME/.wine.bak.$(date +%s)"
|
||||||
|
echo "Old .wine directory backed up."
|
||||||
|
fi
|
||||||
|
|
||||||
# 环境已预装,直接验证
|
echo "=== 初始化一个新的干净的Wine环境 ==="
|
||||||
- name: Verify tools
|
# 初始化Wine环境,使用 xvfb-run 避免任何图形界面问题
|
||||||
|
# 设置 WINEARCH 为 win64 以支持64位
|
||||||
|
export WINEARCH=win64
|
||||||
|
xvfb-run wineboot -u
|
||||||
|
|
||||||
|
echo "=== 验证新环境 ==="
|
||||||
|
# 等待几秒让环境初始化完成
|
||||||
|
sleep 5
|
||||||
|
wine --version
|
||||||
|
xvfb-run wine cmd /c "echo Wine environment is ready"
|
||||||
|
|
||||||
|
# 步骤3:安装 Python(使用正确的文件名)
|
||||||
|
- name: Install Python in Wine
|
||||||
run: |
|
run: |
|
||||||
node --version
|
echo "Current directory: $(pwd)"
|
||||||
wine python --version
|
ls -lah
|
||||||
wine --version # 确认 wine 是否存在,full 镜像很可能包含
|
|
||||||
|
|
||||||
- name: Build EXE using Wine Python
|
if [ ! -f python-3.9.9-amd64.exe ]; then
|
||||||
|
echo "Installer not found!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 直接用 wine 运行
|
||||||
|
xvfb-run -a wine python-3.9.9-amd64.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0
|
||||||
|
|
||||||
|
# 等待安装
|
||||||
|
sleep 20
|
||||||
|
|
||||||
|
# 步骤4:更彻底地查找 Python
|
||||||
|
- name: Find and verify Python
|
||||||
run: |
|
run: |
|
||||||
wine python -m PyInstaller --onefile --windowed --name Shortcut_Sync_PotPlayer main.py
|
echo "=== Searching all possible Python locations ==="
|
||||||
|
# 查找所有 python.exe
|
||||||
|
find /root/.wine/drive_c -name "python.exe" 2>/dev/null | while read path; do
|
||||||
|
echo "Found: $path"
|
||||||
|
echo "Version info:"
|
||||||
|
wine "$path" --version 2>/dev/null || echo "Cannot run $path"
|
||||||
|
done
|
||||||
|
|
||||||
|
# 尝试常见路径
|
||||||
|
COMMON_PATHS=(
|
||||||
|
"/root/.wine/drive_c/Python39/python.exe"
|
||||||
|
"/root/.wine/drive_c/Python39-32/python.exe"
|
||||||
|
"/root/.wine/drive_c/Program Files/Python39/python.exe"
|
||||||
|
"/root/.wine/drive_c/users/runner/AppData/Local/Programs/Python/Python39/python.exe"
|
||||||
|
)
|
||||||
|
|
||||||
|
for path in "${COMMON_PATHS[@]}"; do
|
||||||
|
if [ -f "$path" ]; then
|
||||||
|
echo "Found Python at standard location: $path"
|
||||||
|
PYTHON_EXE="$path"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$PYTHON_EXE" ]; then
|
||||||
|
echo "Python not found in standard locations"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "PYTHON_EXE=$PYTHON_EXE" >> $GITHUB_ENV
|
||||||
|
wine "$PYTHON_EXE" --version
|
||||||
|
|
||||||
|
# 步骤5:安装依赖
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
# 升级 pip
|
||||||
|
wine "$PYTHON_EXE" -m pip install --upgrade pip
|
||||||
|
# 安装包
|
||||||
|
wine "$PYTHON_EXE" -m pip install pyinstaller keyboard pywin32
|
||||||
|
|
||||||
|
# 步骤6:构建 EXE
|
||||||
|
- name: Build EXE
|
||||||
|
run: |
|
||||||
|
wine "$PYTHON_EXE" -m PyInstaller --onefile --windowed --name Shortcut_Sync_PotPlayer main.py
|
||||||
|
|
||||||
|
# 步骤7:上传构建产物(修复版本)
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: christopherhx/gitea-upload-artifact@v4 # 关键修复!
|
||||||
with:
|
with:
|
||||||
name: Shortcut_Sync_PotPlayer
|
name: Shortcut_Sync_PotPlayer
|
||||||
path: dist/Shortcut_Sync_PotPlayer.exe
|
path: dist/Shortcut_Sync_PotPlayer.exe
|
||||||
Reference in New Issue
Block a user