From 34396997629b88acc6f21b989461c31d00249b3a Mon Sep 17 00:00:00 2001 From: Ircama Date: Mon, 29 Jul 2024 11:03:58 +0200 Subject: [PATCH] Add build workflow --- .github/workflows/build.yml | 51 +++++++++++++++++++++++++++++++++++++ README.md | 21 ++++++++++----- 2 files changed, 65 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4ccfbc6 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,51 @@ +name: Build Workflow + +on: + push: +# branches: master + +jobs: + build-windows: + runs-on: windows-2019 + steps: + - name: Checkout + uses: actions/checkout@v1 + - name: Install Python + uses: actions/setup-python@v1 + with: + python-version: '3.10' + architecture: 'x64' + - name: Install requirements + run: | + pip install -r requirements.txt + - name: Run PyInstaller + run: | + python -m PyInstaller epson_print_conf.spec -- --default + - uses: actions/upload-artifact@v2 + with: + name: epson_print_conf + path: dist\epson_print_conf.exe + + - name: create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.event.head_commit.message }} + release_name: ${{ github.event.head_commit.message }} + overwrite: true + body: | + Release v2.1.0 + draft: false + prerelease: false + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{steps.create_release.outputs.upload_url}} + asset_path: dist\epson_print_conf.exe + asset_name: epson_print_conf.exe + asset_content_type: application/zip diff --git a/README.md b/README.md index 8e452b1..210fbba 100644 --- a/README.md +++ b/README.md @@ -55,19 +55,26 @@ It is tested with Ubuntu / Windows Subsystem for Linux, Windows. ## Creating an executable for the GUI +Alternatively to run the GUI via `python ui.py`, it is possible to build an executable file via *pyinstaller*. + Install *pyinstaller* with `pip install pyinstaller`. -To create an executable file named *epson_print_conf.exe* from *ui.py*, run the following: +The *epson_print_conf.spec* file helps building the executable program. Run it with the following command. + +```bash +pip install pyinstaller # if not yet installed +pyinstaller epson_print_conf.spec -- --default +``` + +Then run the *epson_print_conf.exe* file created in the *dist/* folder, which has the same options of `ui.py`. + +An alternative way to create the executable file named *epson_print_conf.exe* from *ui.py* without using *epson_print_conf.spec* is the following: ```bash pyinstaller --onefile ui.py --name epson_print_conf --hidden-import babel.numbers --windowed ``` -Then run the *epson_print_conf.exe* file created in the *dist/* folder, which has the same options of `ui.py`. - -The package includes another file named *gui.py*, which also automatically loads the configuration file *printer_conf.pickle*, merging it with the program configuration. In this case, the *epson_print_conf.spec* file helps creating an executable with *pyinstaller*. - -Run the following to build the executable: +A file named *gui.py* is also included (similar to *ui.py*), which automatically loads a previously created configuration file that has to be named *printer_conf.pickle*, merging it with the program configuration. To build the executable program with this file instead of the default *ui.py*, run the following command: ```bash pip install pyinstaller # if not yet installed @@ -76,7 +83,7 @@ python3 parse_devices.py -a 192.168.178.29 -s XP-205 -p printer_conf.pickle # u pyinstaller epson_print_conf.spec ``` -Run the *epson_print_conf.exe* file created in the *dist/* folder. This executable program does not have options, embeds the *printer_conf.pickle* file and starts with the default IP address and printer model defined in the build phase. +When the build operation is completed, you can run the *epson_print_conf.exe* file created in the *dist/* folder. This executable program does not have options, embeds the *printer_conf.pickle* file and starts with the default IP address and printer model defined in the build phase. ## Usage