Release Python Package to PyPi #35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | |
| name: Release Python Package to PyPi | |
| on: [ workflow_dispatch ] | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies | |
| run: | | |
| pip install -r requirements/packaging.txt | |
| - name: Build | |
| run: | | |
| python -m build | |
| - name: Publish | |
| env: | |
| TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
| TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
| run: | | |
| twine upload dist/* | |
| - name: Tag | |
| run: | | |
| git config user.name github-actions | |
| git config user.email [email protected] | |
| VERSION="$(cat drf_spectacular/__init__.py | grep "__version__" | cut -d"'" -f2)" | |
| git tag -a $VERSION -m 'version $VERSION' | |
| git push --tags |