Publish Python Package #46
Workflow file for this run
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
| name: Publish Python Package | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install build tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install --upgrade build twine | |
| - name: Build distributions | |
| run: python -m build | |
| - name: Upload to PyPI or TestPyPI | |
| env: | |
| TWINE_USERNAME: __token__ | |
| PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
| TESTPYPI_TOKEN: ${{ secrets.TESTPYPI_TOKEN }} | |
| run: | | |
| # 💡 ACTIVATE ONE LINE ONLY: | |
| twine upload --repository-url https://test.pypi.org/legacy/ -u __token__ -p "$TESTPYPI_TOKEN" dist/* --verbose | |
| # twine upload -u __token__ -p "$PYPI_TOKEN" dist/* --verbose |