You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.5 KiB

2 months ago
  1. # This workflow will build and (if release) publish Python distributions to PyPI
  2. # For more information see:
  3. # - https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
  4. # - https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
  5. #
  6. ---
  7. name: build-publish
  8. on:
  9. push:
  10. branches: [master]
  11. pull_request:
  12. branches: [master]
  13. release:
  14. types: [published]
  15. jobs:
  16. build-wheels:
  17. runs-on: ubuntu-latest
  18. permissions:
  19. contents: read
  20. steps:
  21. - uses: actions/checkout@v3
  22. - name: Set up Python
  23. uses: actions/setup-python@v4
  24. with:
  25. python-version: '3.x'
  26. - name: Install pypa/build
  27. run: >-
  28. python -m
  29. pip install -U
  30. build
  31. - name: Build a binary wheel and a source tarball
  32. run: >-
  33. python -m
  34. build
  35. --sdist
  36. --wheel
  37. --outdir dist/
  38. .
  39. - name: Store wheels
  40. uses: actions/upload-artifact@v3
  41. with:
  42. path: dist
  43. publish:
  44. runs-on: ubuntu-latest
  45. needs:
  46. - build-wheels
  47. if: github.event_name == 'release' && github.event.action == 'published'
  48. steps:
  49. - name: Download dists
  50. uses: actions/download-artifact@v3
  51. with:
  52. name: artifact
  53. path: dist
  54. - name: Publish
  55. uses: pypa/gh-action-pypi-publish@release/v1
  56. with:
  57. password: ${{ secrets.PYPI_API_TOKEN }}