| 1 |
name: Publish Python distributions to PyPI |
| 2 |
|
| 3 |
on: |
| 4 |
release: |
| 5 |
types: [published] |
| 6 |
|
| 7 |
jobs: |
| 8 |
build-n-publish: |
| 9 |
name: Build and publish Python distributions to PyPI |
| 10 |
runs-on: ubuntu-latest |
| 11 |
environment: |
| 12 |
name: pypi |
| 13 |
url: https://pypi.org/project/RachioPy |
| 14 |
permissions: |
| 15 |
id-token: write |
| 16 |
steps: |
| 17 |
- uses: actions/checkout@master |
| 18 |
- name: Set up Python 3.x |
| 19 |
uses: actions/setup-python@v2 |
| 20 |
with: |
| 21 |
python-version: 3.x |
| 22 |
- name: Install dependencies |
| 23 |
run: | |
| 24 |
python -m pip install --upgrade pip setuptools wheel |
| 25 |
python -m pip install -r requirements.txt |
| 26 |
|
| 27 |
- name: Run unit tests |
| 28 |
run: python -m unittest discover -v tests |
| 29 |
- name: Build distribution |
| 30 |
run: python setup.py sdist bdist_wheel |
| 31 |
- name: Publish distribution to Test PyPI |
| 32 |
if: startsWith(github.ref, 'refs/tags') |
| 33 |
uses: pypa/gh-action-pypi-publish@release/v1 |
| 34 |
with: |
| 35 |
repository-url: https://test.pypi.org/legacy/ |
| 36 |
- name: Publish distribution to PyPI |
| 37 |
if: startsWith(github.ref, 'refs/tags') |
| 38 |
uses: pypa/gh-action-pypi-publish@release/v1 |