cd.yml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
  2. on:
  3. # release:
  4. # types: [published]
  5. workflow_dispatch: ~
  6. push:
  7. branches: [master]
  8. tags: [v*]
  9. jobs:
  10. build-n-publish:
  11. name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
  12. runs-on: ubuntu-latest
  13. # permissions:
  14. # id-token: write
  15. steps:
  16. - uses: actions/checkout@v4
  17. - name: Set up Python
  18. uses: actions/setup-python@v2
  19. with:
  20. python-version: '3.12'
  21. - name: Install Dependencies
  22. run: |
  23. python -m pip install --upgrade pip wheel setuptools poetry
  24. poetry config virtualenvs.in-project true
  25. poetry install
  26. - name: Build a binary wheel and a source tarball
  27. run: |
  28. poetry build
  29. # - name: Publish distribution 📦 to Test PyPI
  30. # uses: pypa/gh-action-pypi-publish@release/v1
  31. # with:
  32. # repository_url: https://test.pypi.org/legacy/
  33. # packages_dir: dist/
  34. # password: ${{ secrets.PYPI_TOKEN }}
  35. - name: Publish distribution 📦 to PyPI
  36. if: startsWith(github.ref, 'refs/tags')
  37. uses: pypa/gh-action-pypi-publish@release/v1
  38. with:
  39. packages_dir: dist/
  40. password: ${{ secrets.PYPI_TOKEN }}