ci: 将Nuitka构建模式从standalone改为onefile并禁用控制台窗口 #7
Workflow file for this run
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
| # .github/workflows/nuitka-windows-release.yml | |
| name: Nuitka Windows Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Check-out repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| architecture: 'x64' | |
| cache: 'pip' | |
| cache-dependency-path: | | |
| **/requirements*.txt | |
| - name: Install Dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Set version from tag | |
| id: version | |
| run: | | |
| $version = "${{ github.ref_name }}" | |
| if ($version -notmatch '^v?\d+\.\d+\.\d+') { | |
| $version = "1.0.0" | |
| } | |
| # 移除 'v' 前缀 | |
| $version = $version -replace '^v', '' | |
| Write-Output "version=$version" >> $env:GITHUB_OUTPUT | |
| shell: pwsh | |
| - name: Build Windows Executable with Nuitka | |
| uses: Nuitka/Nuitka-Action@main | |
| with: | |
| nuitka-version: main | |
| script-name: main.py | |
| mode: onefile | |
| enable-plugins: tk-inter | |
| product-name: Modpack-Localizer-Pro | |
| product-version: ${{ steps.version.outputs.version }} | |
| company-name: Modpack-Localizer | |
| file-description: Modpack Localizer Application | |
| copyright: Modpack-Localizer | |
| windows-uac-admin: false | |
| windows-disable-console: true | |
| include-package: | | |
| gui | |
| services | |
| utils | |
| core | |
| include-data-files: | | |
| requirements.txt=requirements.txt | |
| - name: Upload Release Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Modpack-Localizer-Pro-Windows | |
| path: build/main.exe | |
| include-hidden-files: true | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| files: build/main.exe | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |