Skip to content

Commit

Permalink
Update build spec and script
Browse files Browse the repository at this point in the history
  • Loading branch information
JWCook committed Dec 6, 2023
1 parent b1876c9 commit be6aa54
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
25 changes: 17 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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 .
Expand All @@ -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 .
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packaging/naturtag.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit be6aa54

Please sign in to comment.