Build and upload to PyPI #30
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: Build and upload to PyPI | |
on: | |
workflow_dispatch: | |
release: | |
types: | |
- published | |
jobs: | |
build: | |
name: Build universal wheel and source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/install-python-and-package | |
with: | |
extras-require: publishing | |
- name: Build wheel and source distribution | |
run: python -m build | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/* | |
upload_test_pypi: | |
needs: [build] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'workflow_dispatch' | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@v1.4.2 | |
with: | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
upload_pypi: | |
needs: [build] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@v1.4.2 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} |