| name: Publish Package to PyPI |
| |
| on: |
| push: |
| branches: |
| - master |
| release: |
| types: [published] |
| |
| jobs: |
| build-and-publish: |
| runs-on: ubuntu-latest |
| |
| steps: |
| - name: Checkout code |
| uses: actions/checkout@v3 |
| |
| - name: Set up Python |
| uses: actions/setup-python@v4 |
| with: |
| python-version: '3.10' |
| |
| - name: Install Poetry |
| run: | |
| python -m pip install --upgrade pip |
| pip install poetry |
| |
| - name: Install dependencies |
| run: | |
| poetry install --no-interaction --no-ansi |
| |
| - name: Build package |
| run: | |
| poetry build |
| |
| - name: Publish to PyPI |
| env: |
| TWINE_USERNAME: __token__ |
| TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} |
| run: | |
| poetry publish --username $TWINE_USERNAME --password $TWINE_PASSWORD --no-interaction --no-ansi |