publish-to-test-pypi.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
  2. on: push
  3. #on:
  4. #push:
  5. #branches: [master]
  6. jobs:
  7. build-n-publish:
  8. name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
  9. runs-on: ubuntu-latest
  10. steps:
  11. - uses: actions/checkout@master
  12. - name: Set up Python 3.8
  13. uses: actions/setup-python@v1
  14. with:
  15. python-version: 3.8
  16. - name: Install pep517
  17. run: >-
  18. python -m
  19. pip install
  20. pep517
  21. --user
  22. - name: Build a binary wheel and a source tarball
  23. run: >-
  24. python -m
  25. pep517.build
  26. --source
  27. --binary
  28. --out-dir dist/
  29. .
  30. - name: Publish distribution 📦 to Test PyPI
  31. env:
  32. test_pypi_password: ${{ secrets.test_pypi_password }}
  33. if: env.test_pypi_password != null && endsWith(github.ref, 'master') && github.repository_owner == 'pything'
  34. uses: pypa/gh-action-pypi-publish@release/v1
  35. with:
  36. password: ${{ secrets.test_pypi_password }}
  37. repository_url: https://test.pypi.org/legacy/
  38. - name: Publish distribution 📦 to PyPI
  39. env:
  40. pypi_password: ${{ secrets.pypi_password }}
  41. if: env.pypi_password != null && startsWith(github.ref, 'refs/tags') && github.repository_owner == 'pything'
  42. uses: pypa/gh-action-pypi-publish@release/v1
  43. with:
  44. password: ${{ secrets.pypi_password }}
  45. #verbose: true
  46. #skip_existing: true