Skip to content

Build Windows EXE

Build Windows EXE #1

Workflow file for this run

# 自动打包工作流:在 GitHub 仓库页面手动点击运行(Actions → Build Windows EXE → Run workflow),
# 使用 PyInstaller 将程序打包为 Windows 独立 .exe,并上传 Artifact。
name: Build Windows EXE
on:
# 仅支持手动触发,不再因推送 tag 自动打包
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
steps:
- name: 检出代码
uses: actions/checkout@v4
- name: 安装 Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: 安装依赖
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: PyInstaller 打包
# --onefile : 打包为单个 exe
# --noconsole: 不弹出黑色控制台窗口
# --name : 输出文件名 auto_fish.exe
run: >
pyinstaller --onefile --noconsole
--name auto_fish
main.py
- name: 上传 Artifact
uses: actions/upload-artifact@v4
with:
name: auto_fish-windows
path: dist/auto_fish.exe
if-no-files-found: error