Publish python distribution to PyPI #1
Workflow file for this run
This file contains 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 distribution to PyPI | |
on: | |
release: | |
types: | |
- published | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install setuptools wheel twine | |
- name: Build a binary wheel and a source tarball | |
run: | | |
python setup.py sdist bdist_wheel | |
- name: Upload distributions | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "distributions-for-${{ github.event.release.tag_name }}" | |
path: dist/ | |
publish-to-pypi: | |
name: Publish to PyPI | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download distributions | |
uses: actions/download-artifact@v4 | |
with: | |
name: "distributions-for-${{ github.event.release.tag_name }}" | |
path: dist/ | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
username: __token__ | |
repository-url: https://pypi.org/legacy/ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |