Skip to content

win32timezone no longer required #127

win32timezone no longer required

win32timezone no longer required #127

Workflow file for this run

name: Deploy
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
pre-release-suffix:
description: 'Version suffix for pre-release package ("a", "b", "rc", etc.)'
required: false
default: ''
pre-release-version:
description: 'Version number for pre-release package (defaults to build number)'
required: false
default: ''
publish:
description: 'Publish package to PyPI'
required: false
default: 'true'
env:
LATEST_PY_VERSION: '3.12'
# Required for creating a new release
permissions:
contents: write
jobs:
build-app-packages:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.LATEST_PY_VERSION }}
- uses: snok/[email protected]
with:
virtualenvs-in-project: true
# Install binary + python dependencies
- name: Install system packages
if: startsWith(matrix.os, 'ubuntu')
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@v4
with:
path: .venv
key: venv-${{ env.LATEST_PY_VERSION }}-pyinstaller-${{ matrix.os }}-${{ hashFiles('poetry.lock') }}
- name: Install python packages
if: steps.cache.outputs.cache-hit != 'true'
run: |
poetry install -v --only main
poetry run pip install -U pyinstaller setuptools
- 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: startsWith(matrix.os, 'ubuntu')
run: |
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 .
echo "DIST_NAME=linux" >> $GITHUB_ENV
- name: Finish pyinstaller package (macOS)
if: startsWith(matrix.os, 'macos')
run: |
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 .
echo "DIST_NAME=macos" >> $GITHUB_ENV
- name: Finish pyinstaller package (Windows)
if: startsWith(matrix.os, 'windows')
run: |
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
# Build deb, snap, and rpm packages
- name: Build Linux packages with FPM
if : startsWith(matrix.os, 'ubuntu')
run: |
export GEM_HOME="$(ruby -e 'puts Gem.user_dir')"
export PATH="$PATH:$GEM_HOME/bin"
gem install fpm --user-install
cd packaging
./build_fpm.sh
# Build dmg package
- name: Build disk image (macOS)
if: startsWith(matrix.os, 'macos')
run: |
brew install create-dmg
cd packaging
./build_dmg.sh
# Upload workflow artifacts
- name: Upload pyinstaller package
uses: actions/upload-artifact@v4
with:
name: naturtag-${{ env.DIST_NAME }}.tar.gz
path: naturtag-${{ env.DIST_NAME }}.tar.gz
- name: Upload disk image (macOS)
if: startsWith(matrix.os, 'macos')
uses: actions/upload-artifact@v4
with:
name: naturtag.dmg
path: dist/naturtag.dmg
- name: Upload FPM workflow artifacts (Linux)
if : startsWith(matrix.os, 'ubuntu')
uses: actions/upload-artifact@v4
with:
name: naturtag-fpm
path: dist/naturtag.*
# Create a release with all workflow artifacts attached
release-app-packages:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: build-app-packages
steps:
- uses: actions/download-artifact@v4
- name: Collect artifacts from workflow subdirs
run: |
find . -type d -depth -name 'naturtag*' -exec mv {} {}_dir \;
find . -type f -mindepth 2 -exec mv -- {} . \;
rmdir *_dir
ls -ARl
- name: Create release
uses: softprops/action-gh-release@v2
with:
files: 'naturtag*'
body: |
See changelog for release details: https://github.com/pyinat/naturtag/blob/main/HISTORY.md
See docs for installation instructions: https://naturtag.readthedocs.io/en/stable/installation.html
draft: true
# Publish python package to PyPI
release-pypi-package:
if: |
github.event.inputs.publish != 'false'
&& (startsWith(github.ref, 'refs/tags/v') || github.event.inputs.pre-release-suffix)
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.LATEST_PY_VERSION }}
- uses: snok/[email protected]
with:
virtualenvs-in-project: true
- name: Set pre-release version
if: github.event.inputs.pre-release-suffix
env:
pre-release-suffix: ${{ github.event.inputs.pre-release-suffix }}
pre-release-version: ${{ github.event.inputs.pre-release-version || github.run_number }}
run: |
poetry version $(poetry version -s).${{ env.pre-release-suffix }}${{ env.pre-release-version }}
poetry version
- name: Build package distributions
run: poetry build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1