Move versioning to setuptools-scm #26
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
name: Test-Build-Deploy | |
on: push | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Run tests | |
run: | | |
python setup.py install | |
pip install -r tests/test-requirements.txt | |
pytest tests/tests.py | |
build: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # this also checks out git tags, which are needed to set the package version | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Build a binary wheel and a source tarball | |
run: pip install wheel && python setup.py sdist bdist_wheel | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: python-dist | |
path: dist/ | |
retention-days: 1 | |
deploy: | |
if: startsWith(github.ref, 'refs/tags') | |
needs: build | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/mplcyberpunk | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: python-dist | |
path: dist/ | |
- name: Publish distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |