diff --git a/.github/workflows/nxdt_host_exe.yml b/.github/workflows/nxdt_host_exe.yml new file mode 100644 index 0000000..7c3b1c1 --- /dev/null +++ b/.github/workflows/nxdt_host_exe.yml @@ -0,0 +1,63 @@ +name: Build Host as Windows Executable + +on: + push: + branches: [rewrite] + + paths: + - 'host/**' + - '.github/workflows/nxdt_host_exe.yml' + + # Allows you to run this workflow manually from the Actions tab. + workflow_dispatch: + +jobs: + build: + runs-on: windows-latest + + defaults: + run: + shell: pwsh + + steps: + - name: Set environment variables + run: | + echo "nxdt_commit=$("${{ github.sha }}".SubString(0, 7))" >> $env:GITHUB_ENV + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.12 + # 3.12.5 was released on 2024-08-06. + # See https://www.python.org/downloads/ for available versions. + + - name: Install dependencies and build EXE + run: .\host\windows_make_standalone.bat + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: nxdt_host-${{ env.nxdt_commit }}.7z + path: host/nxdt_host.7z + if-no-files-found: error + + - name: Upload nxdumptool-rewrite PoC artifacts to pre-release + uses: ncipollo/release-action@v1 + with: + # Only update attachments on "rewrite-prerelease" tag. + prerelease: True + tag: "rewrite-prerelease" + updateOnlyUnreleased: True + # Replace old artifacts with new ones. + removeArtifacts: False + replacesArtifacts: True + # Update preferences. + allowUpdates: True + omitBody: True + omitBodyDuringUpdate: True + omitNameDuringUpdate: True + artifacts: "host/nxdt_host.7z" + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/rewrite.yml b/.github/workflows/rewrite.yml index 75a3c0e..7341c6e 100644 --- a/.github/workflows/rewrite.yml +++ b/.github/workflows/rewrite.yml @@ -104,7 +104,7 @@ jobs: tag: "rewrite-prerelease" updateOnlyUnreleased: True # Remove old artifacts and replace with new ones. - removeArtifacts: True + removeArtifacts: False replacesArtifacts: True # Update preferences. allowUpdates: True diff --git a/host/windows_make_standalone.bat b/host/windows_make_standalone.bat index 0b64e3b..84c4cd7 100644 --- a/host/windows_make_standalone.bat +++ b/host/windows_make_standalone.bat @@ -14,7 +14,38 @@ python -m venv "%venvname%" "%venvpython%" -m pip install --upgrade nuitka -r requirements-win32.txt -"%venvpython%" -m nuitka --standalone --deployment --disable-console --windows-icon-from-ico=nxdt.ico --enable-plugin=tk-inter nxdt_host.py +REM Useful command line arguments for Nuitka: + +REM --standalone +REM Enable standalone mode for output. This allows you to transfer the created +REM binary to other machines without it using an existing Python installation. +REM It implies these option: "--follow-imports" and "--python-flag=no_site". + +REM --assume-yes-for-downloads +REM Allow Nuitka to download external code if necessary, e.g. dependency +REM walker, ccache, and even gcc on Windows. + +REM --deployment +REM Disable code aimed at making finding compatibility issues easier. +REM This will e.g. prevent execution with "-c" argument, which is often +REM used by code that attempts run a module, and causes a program to start +REM itself over and over potentially. + +REM --windows-console-mode +REM Select console mode to use. Default mode is 'force' and creates a console +REM window unless the program was started from one. With 'disable' it doesn't +REM create or use a console at all. With 'attach' an existing console will be +REM used for outputs. Default is 'force'. + +REM --windows-icon-from-ico=nxdt.ico +REM Add executable icon. Can be given multiple times for different resolutions +REM or files with multiple icons inside. + +REM --enable-plugin=tk-inter +REM Enabled plugins. Must be plug-in names. Use '--plugin-list' to query the +REM full list and exit. + +"%venvpython%" -m nuitka --standalone --assume-yes-for-downloads --deployment --windows-console-mode=attach --windows-icon-from-ico=nxdt.ico --enable-plugin=tk-inter nxdt_host.py del /F /Q nxdt_host.7z 7z a nxdt_host.7z .\nxdt_host.dist\*