publish.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. name: Releases to PyPi
  2. on:
  3. push:
  4. tags:
  5. - '[0-9]+.[0-9]+[0-9]+.[0-9]'
  6. - '[0-9]+.[0-9]+[0-9]+.[0-9]'
  7. - '[0-9]+.[0-9]+[0-9]+.[0-9]'
  8. # Allows you to run this workflow manually from the Actions tab
  9. workflow_dispatch:
  10. jobs:
  11. build:
  12. runs-on: ubuntu-latest
  13. strategy:
  14. matrix:
  15. python-version: [3.8]
  16. steps:
  17. - name: 🛎️ Checkout
  18. uses: actions/checkout@v3
  19. with:
  20. ref: ${{ github.head_ref }}
  21. - name: 🐍 Set up Python ${{ matrix.python-version }}
  22. uses: actions/setup-python@v5
  23. with:
  24. python-version: ${{ matrix.python-version }}
  25. - name: Install dependencies
  26. run: |
  27. python -m pip install --upgrade pip
  28. pip install --upgrade build setuptools wheel twine
  29. python setup.py install
  30. - name: Build source and wheel distributions
  31. env:
  32. TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
  33. TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
  34. run: |
  35. python setup.py sdist bdist_wheel
  36. twine upload dist/*
  37. # python -m build
  38. - name: 🚀 Publish to PyPi
  39. uses: pypa/gh-action-pypi-publish@release/v1
  40. with:
  41. user: ${{ secrets.PYPI_USERNAME }}
  42. password: ${{ secrets.PYPI_PASSWORD }}
  43. - name: 🚀 Publish to Test-PyPi
  44. uses: pypa/gh-action-pypi-publish@release/v1
  45. with:
  46. repository-url: https://test.pypi.org/legacy/
  47. user: ${{ secrets.PYPI_TEST_USERNAME }}
  48. password: ${{ secrets.PYPI_TEST_PASSWORD }}