Upload Python Package #79
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
| # This workflows will upload a Python Package using Twine when a release is created | |
| # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | |
| name: Upload Python Package | |
| on: | |
| workflow_dispatch | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: '3.x' | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build twine | |
| - name: Build the package | |
| run: | | |
| python -m build | |
| - name: Publish to PyPI | |
| env: | |
| TWINE_USERNAME: ${{ secrets.PIP_USERNAME }} | |
| TWINE_PASSWORD: ${{ secrets.PIP_PASSWORD }} | |
| run: | | |
| twine upload dist/* | |
| - name: Tag and push new version | |
| run: | | |
| version_name=$(grep -m 1 version pyproject.toml | grep -Eo '[0-9]{1,}.[0-9]{1,}.[0-9]{1,}') | |
| git config --global user.name "Tag Bot" | |
| git config --global user.email "hello@cradl.ai" | |
| git tag -a "$version_name" -m "Version $version_name" | |
| git push origin "$version_name" | |