From be6aa540ebf68f37e48c974cc363bb1ae6ad9197 Mon Sep 17 00:00:00 2001 From: Jordan Cook Date: Wed, 6 Dec 2023 01:07:51 -0600 Subject: [PATCH] Update build spec and script --- .github/workflows/deploy.yml | 25 +++++++++++++++++-------- packaging/naturtag.spec | 2 +- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e40f1246..634d5f86 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -13,6 +13,11 @@ on: description: 'Version number for pre-release package (defaults to build number)' required: false default: '' + publish: + description: 'Set to "false" to skip publishing to PyPI' + required: false + default: 'true' + env: LATEST_PY_VERSION: '3.11' @@ -39,29 +44,30 @@ jobs: with: virtualenvs-in-project: true + # Install binary + python dependencies - name: Install system packages if: ${{ matrix.os == 'ubuntu-latest' }} run: sudo apt-get install -y '^libxcb.*-dev' libegl-dev libwebp-dev libpng16-16 libx11-xcb-dev rpm - - name: Cache python packages id: cache uses: actions/cache@v3 with: path: .venv key: venv-${{ env.LATEST_PY_VERSION }}-pyinstaller-${{ matrix.os }}-${{ hashFiles('poetry.lock') }} - - name: Install dependencies + - name: Install python packages if: steps.cache.outputs.cache-hit != 'true' run: | poetry install -v --without dev poetry run pip install -U pyinstaller setuptools - - name: Build PyInstaller package + + - name: Build pyinstaller package run: poetry run pyinstaller -y packaging/naturtag.spec # Include taxon FTS db, compress, and set platform name - name: Finish pyinstaller package (Linux) if: ${{ matrix.os == 'ubuntu-latest' }} run: | - ASSETS=dist/naturtag/assets + ASSETS=dist/naturtag/_internal/assets/data tar -xvzf $ASSETS/taxonomy.tar.gz --directory $ASSETS/ rm $ASSETS/taxonomy.tar.gz tar -C dist/naturtag/ -czvf naturtag-linux.tar.gz . @@ -70,7 +76,7 @@ jobs: - name: Finish pyinstaller package (macOS) if: ${{ matrix.os == 'macos-latest' }} run: | - ASSETS=dist/naturtag.app/Contents/Resources/assets + ASSETS=dist/naturtag.app/Contents/Resources/assets/data tar -xvzf $ASSETS/taxonomy.tar.gz --directory $ASSETS/ rm $ASSETS/taxonomy.tar.gz tar -C dist/naturtag/ -czvf naturtag-macos.tar.gz . @@ -79,8 +85,9 @@ jobs: - name: Finish pyinstaller package (Windows) if: ${{ matrix.os == 'windows-latest' }} run: | - tar -xvzf dist/naturtag/assets/taxonomy.tar.gz --directory dist/naturtag/assets/ - rm dist/naturtag/assets/taxonomy.tar.gz + ASSETS=dist/naturtag/_internal/assets/data + tar -xvzf $ASSETS/taxonomy.tar.gz --directory $ASSETS/ + rm $ASSETS/taxonomy.tar.gz tar -C dist/naturtag/ -czvf naturtag-windows.tar.gz . echo "DIST_NAME=windows" >> $GITHUB_ENV @@ -144,7 +151,9 @@ jobs: # Publish python package to PyPI release-pypi-package: - if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.pre-release-suffix + if: | + github.event.inputs.publish == 'true' + && (startsWith(github.ref, 'refs/tags/v') || github.event.inputs.pre-release-suffix) runs-on: ubuntu-latest permissions: id-token: write diff --git a/packaging/naturtag.spec b/packaging/naturtag.spec index 100fef70..48ded376 100644 --- a/packaging/naturtag.spec +++ b/packaging/naturtag.spec @@ -2,7 +2,7 @@ from pathlib import Path from PyInstaller.compat import is_darwin, is_linux, is_win -BUILD_PY_VERSION = '3.10' +BUILD_PY_VERSION = '3.11' PROJECT_NAME = 'naturtag' PROJECT_DIR = Path('.').absolute() ASSETS_DIR = PROJECT_DIR / 'assets'