Skip to content

Workflow file for this run

# Builds mhkit and publishes to testpypi.org on every commit to master. On tagged commits, also publishes to pypi.org.
# https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
name: Build and release 🐍 📦
on:
push:
branches:
- master
release:
types: [published]
jobs:
build-and-publish:
name: Build and release 🐍 📦
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: 3.8
- run: python -m pip install build --user
- run: python -m build --sdist --wheel --outdir dist/ .
- name: Upload to Test PyPI
if: github.event_name != 'release' && github.repository_owner == 'MHKiT-Software'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
skip-existing: true
- name: Upload to PyPI (tagged release only)
if:
github.repository_owner == 'MHKiT-Software' && github.event_name == 'release' &&
github.event.action == 'published'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}