1
0

python-publish.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # This workflows will upload a Python Package using Twine when a release is created
  2. # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
  3. name: Upload Python Package
  4. on:
  5. release:
  6. types: [created]
  7. jobs:
  8. build:
  9. name: Build distribution 📦
  10. runs-on: ubuntu-latest
  11. steps:
  12. - uses: actions/checkout@v4
  13. - name: Set up Python
  14. uses: actions/setup-python@v5
  15. with:
  16. python-version: "3.x"
  17. - name: Install pypa/build
  18. run: >-
  19. python3 -m
  20. pip install
  21. build
  22. --user
  23. - name: Build a binary wheel and a source tarball
  24. run: python3 -m build
  25. - name: Store the distribution packages
  26. uses: actions/upload-artifact@v4
  27. with:
  28. name: python-package-distributions
  29. path: dist/
  30. deploy:
  31. permissions:
  32. id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
  33. runs-on: ubuntu-latest
  34. needs:
  35. - build
  36. name: >-
  37. Publish Python 🐍 distribution 📦 to PyPI
  38. environment:
  39. name: pypi
  40. url: https://pypi.org/p/pySwitchbot
  41. steps:
  42. - name: Download all the dists
  43. uses: actions/download-artifact@v4
  44. with:
  45. name: python-package-distributions
  46. path: dist/
  47. - name: Publish package distributions to PyPI
  48. uses: pypa/gh-action-pypi-publish@release/v1