From 8cbc87b97d1476f3ed84403c39e0c290abdaea57 Mon Sep 17 00:00:00 2001 From: R4SAS Date: Sat, 10 Dec 2022 02:59:57 +0300 Subject: [PATCH] [gha] pyinstall binaries build Signed-off-by: R4SAS --- .github/workflows/binary.yml | 24 ++++++++++++++++++++++++ pbincli/actions.py | 6 +++--- pbincli/utils.py | 2 +- 3 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/binary.yml diff --git a/.github/workflows/binary.yml b/.github/workflows/binary.yml new file mode 100644 index 0000000..f903b11 --- /dev/null +++ b/.github/workflows/binary.yml @@ -0,0 +1,24 @@ +name: Package Application with Pyinstaller + +on: [push, pull_request] + +jobs: + build: + name: Binary for windows + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - name: Setup python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Build executable with pyinstaller + run: | + python -m pip install --upgrade pip + pip install . + pip install pyinstaller pywin32-ctypes + pyinstaller pbincli.spec + - uses: actions/upload-artifact@v2 + with: + name: pbincli-windows + path: dist/* diff --git a/pbincli/actions.py b/pbincli/actions.py index ab7c162..c3c84ba 100644 --- a/pbincli/actions.py +++ b/pbincli/actions.py @@ -1,4 +1,4 @@ -import signal +import signal, sys from urllib.parse import parse_qsl from pbincli.api import Shortener @@ -8,7 +8,7 @@ from pbincli.utils import PBinCLIError, check_writable, json_encode, uri_validat def signal_handler(sig, frame): print('Keyboard interrupt received, terminating…') - exit(0) + sys.exit(0) signal.signal(signal.SIGINT, signal_handler) @@ -68,7 +68,7 @@ def send(args, api_client, settings=None): if args.debug: print("Passphrase:\t{}\nRequest:\t{}".format(paste.getHash(), request)) # If we use dry option, exit now - if args.dry: exit(0) + if args.dry: sys.exit(0) print("Uploading paste…") result = api_client.post(request) diff --git a/pbincli/utils.py b/pbincli/utils.py index a371c84..65f10b0 100644 --- a/pbincli/utils.py +++ b/pbincli/utils.py @@ -6,7 +6,7 @@ class PBinCLIException(Exception): def PBinCLIError(message): print("PBinCLI Error: {}".format(message), file=sys.stderr) - exit(1) + sys.exit(1) def path_leaf(path):