更新 package,修复依赖 (#20) #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Nuitka Package and Release | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'package/nuitka_config.yml' | |
| jobs: | |
| package-and-release: | |
| runs-on: windows-latest | |
| # 添加必要的权限 | |
| permissions: | |
| contents: write # 允许创建发布和上传资源 | |
| steps: | |
| - name: Set Timezone to China Standard Time | |
| run: tzutil /s "China Standard Time" | |
| shell: pwsh | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Generate version tag | |
| id: version | |
| run: | | |
| # 使用 UTC 时间确保一致性 | |
| $date = (Get-Date).ToUniversalTime().ToString("yy.MM.dd") | |
| $tag = "v$date" | |
| $release = "Release $date" | |
| echo "tag=$tag" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
| echo "release_name=$release" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: UPX Setup | |
| run: | | |
| mkdir upx | |
| curl -o upx/upx.exe https://assets.ksable.top/github/upx/upx/v5.0.1/windows-amd64/upx.exe | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install nuitka pyyaml ordered-set==4.1.0 wheel==0.38.4 zstandard==0.20.0 | |
| # - name: insatll mingw | |
| # run: | | |
| # mkdir C:\Users\%username%\AppData\Local\Nuitka\Nuitka\Cache\downloads\gcc\x86_64\14.2.0posix-19.1.1-12.0.0-msvcrt-r2 | |
| # curl -o C:\Users\%username%\AppData\Local\Nuitka\Nuitka\Cache\downloads\gcc\x86_64\14.2.0posix-19.1.1-12.0.0-msvcrt-r2\winlibs-x86_64-posix-seh-gcc-14.2.0-llvm-19.1.1-mingw-w64msvcrt-12.0.0-r2.zip https://github.com/brechtsanders/winlibs_mingw/releases/download/14.2.0posix-19.1.1-12.0.0-msvcrt-r2/winlibs-x86_64-posix-seh-gcc-14.2.0-llvm-19.1.1-mingw-w64msvcrt-12.0.0-r2.zip | |
| # tar -xf C:\Users\%username%\AppData\Local\Nuitka\Nuitka\Cache\downloads\gcc\x86_64\14.2.0posix-19.1.1-12.0.0-msvcrt-r2\winlibs-x86_64-posix-seh-gcc-14.2.0-llvm-19.1.1-mingw-w64msvcrt-12.0.0-r2.zip -C C:\Users\%username%\AppData\Local\Nuitka\Nuitka\Cache\downloads\gcc\x86_64\14.2.0posix-19.1.1-12.0.0-msvcrt-r2\ | |
| # - name: Fix Python encoding (Windows) | |
| # run: | | |
| # # 设置Python使用UTF-8编码 | |
| # [System.Environment]::SetEnvironmentVariable('PYTHONUTF8', '1', 'Process') | |
| # # 设置控制台编码为UTF-8 | |
| # chcp.com 65001 | |
| - name: Run packaging script | |
| run: | | |
| # 设置Python使用UTF-8编码 | |
| [System.Environment]::SetEnvironmentVariable('PYTHONUTF8', '1', 'Process') | |
| # 设置控制台编码为UTF-8 | |
| chcp.com 65001 | |
| cd package | |
| python nuitka_build.py nuitka_config.yml | |
| - name: Create Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v1 # 使用更活跃维护的 release 操作 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.version.outputs.tag }} | |
| name: ${{ steps.version.outputs.release_name }} | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: false | |
| overwrite_files: true | |
| files: | | |
| dist/*.exe |