main.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. name: Publish to PyPI
  2. on:
  3. create:
  4. # Allows you to run this workflow manually from the Actions tab
  5. workflow_dispatch:
  6. jobs:
  7. build:
  8. if: ${{ startsWith(github.ref, 'refs/tags') }}
  9. runs-on: ubuntu-latest
  10. steps:
  11. - name: Prepare repo
  12. uses: actions/checkout@v2
  13. - name: Setup Python
  14. uses: actions/setup-python@v1
  15. with:
  16. python-version: 3.9
  17. - name: Install pypa/build
  18. run: >-
  19. python -m
  20. pip install
  21. build
  22. --user
  23. - name: Build a binary wheel and a source tarball
  24. run: >-
  25. python -m
  26. build
  27. --sdist
  28. --wheel
  29. --outdir dist/
  30. .
  31. # - name: Publish distribution 📦 to Test PyPI
  32. # uses: pypa/gh-action-pypi-publish@master
  33. # with:
  34. # skip_existing: true
  35. # password: ${{ secrets.TEST_PIP_API_TOKEN }}
  36. # repository_url: https://test.pypi.org/legacy/
  37. - name: Publish distribution 📦 to PyPI
  38. uses: pypa/gh-action-pypi-publish@master
  39. with:
  40. password: ${{ secrets.PIP_API_TOKEN }}