Skip to content

Address lacking importlib metadata in Python ≤ 3.9 (#442) #92

Address lacking importlib metadata in Python ≤ 3.9 (#442)

Address lacking importlib metadata in Python ≤ 3.9 (#442) #92

name: Freeze, Release & Publish
on:
push:
branches:
- master
tags:
- v*
pull_request:
branches:
- master
jobs:
freeze:
name: "Freeze: ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install tox
run: pip install tox
- name: Build binary
run: tox -e freeze
- name: Pack binary (Windows)
if: ${{ runner.os == 'Windows' }}
run: 7z a shub-Windows.zip dist_bin/shub.exe
- name: Pack binary (Linux/macOS)
if: ${{ runner.os != 'Windows' }}
run: tar -czvf shub-${{ runner.os }}.tar.gz dist_bin/shub
- name: Upload binary
uses: actions/upload-artifact@v2
with:
name: shub-${{ runner.os }}
path: |
shub-${{ runner.os }}.tar.gz
shub-${{ runner.os }}.zip
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: freeze
runs-on: ubuntu-latest
steps:
- name: Download binaries
uses: actions/download-artifact@v2
with:
path: binaries
- name: Display structure of downloaded files
run: ls -R binaries
- name: Draft release
uses: softprops/action-gh-release@v1
with:
draft: true
files: binaries/**
publish:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Publish to PyPI
run: |
pip install --upgrade pip
pip install --upgrade setuptools wheel twine
python setup.py sdist bdist_wheel
export TWINE_USERNAME=__token__
export TWINE_PASSWORD=${{ secrets.PYPI_TOKEN }}
twine upload dist/*