李恒道 发表于 2024-6-27 07:35:05

python 发布到github CI构建Pyinstaller文件

没有requirements.txt依赖表的话首先输入
pip freeze > requirements.txt
生成一下依赖列表
去github创建一个src目录
将py,spces和依赖都放进去
![图片.png](data/attachment/forum/202406/27/073315am5f5fcx7cmcaatz.png)
然后在`.github/workflows/`随便创建一个文件,我叫ci.yml
```

name: Package Application with Pyinstaller

on:
push:
    branches: [ main ]
pull_request:
    branches: [ main ]

jobs:
build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2

    - name: Package Application
      uses: JackMcKew/pyinstaller-action-windows@main
      with:
      path: src

    - uses: actions/upload-artifact@v2
      with:
      name: name-of-artifact
      path: src/dist/windows
```
构建成功了就会在Github Actions里任务的最下面显示构建的文件
![图片.png](data/attachment/forum/202406/27/073440tcxnmcc7m87h7az7.png)
页: [1]
查看完整版本: python 发布到github CI构建Pyinstaller文件