Publish on PyPI #16
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 on PyPI | |
on: | |
workflow_run: | |
workflows: [ "New release" ] | |
types: | |
- completed | |
jobs: | |
build-and-publish: | |
name: Build and publish to PyPI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
- name: Build | |
run: python -m build | |
# - name: Upload to TestPyPI | |
# if: startsWith(github.ref, 'refs/tags') | |
# uses: pypa/gh-action-pypi-publish@release/v1 | |
# with: | |
# verbose: true | |
# user: ${{ secrets.TEST_PYPI_USER }} | |
# password: ${{ secrets.TEST_PYPI_TOKEN }} | |
# repository_url: https://test.pypi.org/legacy/ | |
- name: Upload to PyPI | |
# if: startsWith(github.ref, 'refs/tags') | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
verbose: true | |
user: ${{ secrets.PYPI_USER }} | |
password: ${{ secrets.PYPI_TOKEN }} |