Update the Package (#258) #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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.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/ | |
- 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 }} |