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.

38 lines
1.2 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. # SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
  2. #
  3. # SPDX-License-Identifier: MIT
  4. name: Release Actions
  5. on:
  6. release:
  7. types: [published]
  8. jobs:
  9. upload-pypi:
  10. runs-on: ubuntu-latest
  11. steps:
  12. - uses: actions/checkout@v3
  13. - name: Check For pyproject.toml
  14. id: need-pypi
  15. run: |
  16. echo pyproject-toml=$( find . -wholename './pyproject.toml' ) >> $GITHUB_OUTPUT
  17. - name: Set up Python
  18. if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
  19. uses: actions/setup-python@v4
  20. with:
  21. python-version: '3.x'
  22. - name: Install dependencies
  23. if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
  24. run: |
  25. python -m pip install --upgrade pip
  26. pip install --upgrade build twine
  27. - name: Build and publish
  28. if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
  29. env:
  30. TWINE_USERNAME: ${{ secrets.pypi_username }}
  31. TWINE_PASSWORD: ${{ secrets.pypi_password }}
  32. run: |
  33. find -type f -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) -exec sed -i -e "s/0.0.0+auto.0/${{github.event.release.tag_name}}/" {} +
  34. python -m build
  35. twine upload dist/*