Skip to content

Build and release PyPI #17

Build and release PyPI

Build and release PyPI #17

Workflow file for this run

name: Build and release PyPI
# Based on the similar action for `gumpy`
# Ensure this only runs when (pre)released
on:
release:
types: [released, prereleased]
jobs:
build:
name: Publish release to PyPi
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Create virtualenv and install project (from pyproject.toml)
run: |
python -m pip install --upgrade pip setuptools wheel
# Install the project in editable mode. If you maintain a dev extra in pyproject.toml,
# and you want test/build deps from there, change to: pip install -e ".[dev]"
python -m pip install -e .
- name: Verify Python environment
run: |
python -V
pip --version
pip freeze
- name: Set PYTHONPATH
run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)/src" >> $GITHUB_ENV
- name: Run Pytest and Coverage
run: |
pytest --cov=catomatic src/tests/ --cov-report=xml
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v2
with:
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Install pypa/build
run: python -m pip install --upgrade build
- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}