diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5523a31..ec30fc5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -84,7 +84,7 @@ jobs: uses: vegardit/fast-apt-mirror.sh@v1 - - name: Install Chromium Browser + - name: "Install: Chromium Browser" if: env.ACT == 'true' && startsWith(matrix.os, 'ubuntu') run: | if ! hash google-chrome &>/dev/null; then @@ -94,7 +94,7 @@ jobs: fi - - name: "Install Python and PDM" # https://github.com/pdm-project/setup-pdm + - name: "Install: Python and PDM" # https://github.com/pdm-project/setup-pdm uses: pdm-project/setup-pdm@v4 with: python-version: "${{ matrix.PYTHON_VERSION }}" @@ -180,10 +180,16 @@ jobs: /tmp/upx/upx.exe --version + - name: Build self-contained executable run: | set -eux + if [[ "${{ runner.os }}" == "Windows" ]]; then + NO_UPX=1 pdm run compile + mv dist/kleinanzeigen-bot.exe dist/kleinanzeigen-bot-uncompressed.exe + fi + pdm run compile ls -l dist @@ -234,7 +240,7 @@ jobs: runs-on: ubuntu-latest needs: - build - if: ${{ github.repository_owner == 'Second-Hand-Friends' && github.ref_name == 'main' && !github.event.act }} + if: ${{ github.ref_name == 'main' && !github.event.act }} concurrency: publish-latest-release # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idconcurrency steps: @@ -275,6 +281,7 @@ jobs: mv artifacts-macos-latest/kleinanzeigen-bot kleinanzeigen-bot-darwin-amd64 mv artifacts-ubuntu-latest/kleinanzeigen-bot kleinanzeigen-bot-linux-amd64 + mv artifacts-windows-latest/kleinanzeigen-bot-uncompressed.exe kleinanzeigen-bot-windows-amd64-uncompressed.exe mv artifacts-windows-latest/kleinanzeigen-bot.exe kleinanzeigen-bot-windows-amd64.exe # https://cli.github.com/manual/gh_release_create @@ -285,7 +292,8 @@ jobs: --target "${{ github.sha }}" \ kleinanzeigen-bot-darwin-amd64 \ kleinanzeigen-bot-linux-amd64 \ - kleinanzeigen-bot-windows-amd64.exe + kleinanzeigen-bot-windows-amd64.exe \ + kleinanzeigen-bot-windows-amd64-uncompressed.exe - name: "Delete intermediate build artifacts" diff --git a/pyinstaller.spec b/pyinstaller.spec index 8ffa52a..1b05517 100644 --- a/pyinstaller.spec +++ b/pyinstaller.spec @@ -69,7 +69,7 @@ pyz = PYZ( # name = None ) -import shutil +import os, shutil # https://github.com/pyinstaller/pyinstaller/blob/f563dce1e83fd5ec72a20dffd2ac24be3e647150/PyInstaller/building/api.py#L338 exe = EXE(pyz, @@ -94,7 +94,7 @@ exe = EXE(pyz, # contents_directory = "_internal", # using strip on windows results in "ImportError: Can't connect to HTTPS URL because the SSL module is not available." strip = not platform.startswith("win") and shutil.which("strip") is not None, - upx = shutil.which("upx") is not None, + upx = shutil.which("upx") is not None and not os.getenv("NO_UPX"), upx_exclude = [], runtime_tmpdir = None, )