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.

43 lines
1.1 KiB

2 years ago
2 years ago
  1. name: Publish
  2. on:
  3. push:
  4. tags:
  5. - "v*"
  6. jobs:
  7. publish:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - uses: actions/checkout@v3
  11. with:
  12. fetch-depth: "0"
  13. - name: Set up Python 3.10
  14. uses: actions/setup-python@v3
  15. with:
  16. python-version: "3.10"
  17. - name: Install dependencies
  18. run: |
  19. python -m pip install --upgrade pip
  20. python -m pip install tox wheel twine
  21. - name: Apply the tag version
  22. run: |
  23. version=${{ github.ref_name }}
  24. sed -Ei '/^version = /s|= "[0-9.]+"$|= "'${version:-1}'"|' pyproject.toml
  25. - name: Run build
  26. run: |
  27. tox -e build
  28. - name: Publish to PyPi
  29. env:
  30. TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
  31. TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
  32. run: |
  33. twine upload -u $TWINE_USERNAME -p $TWINE_PASSWORD dist/*
  34. - name: Run changelog
  35. run: |
  36. tox -e changelog
  37. - uses: stefanzweifel/git-auto-commit-action@v4
  38. with:
  39. commit_message: "docs: changelog update"
  40. branch: master
  41. file_pattern: CHANGELOG.md