name: Deploy to PyPI on: push: branches: - release/v3/* workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: deploy-test-pypi: name: Build and publish 📦 to TestPyPI if: startsWith(github.ref, 'refs/heads/release/') runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup Python 3.9 uses: actions/setup-python@v4 with: python-version: "3.9" - name: Install pypa/build run: >- python -m pip install build --user - name: Build a binary wheel and a source tarball run: >- python -m build --sdist --wheel --outdir dist/ . - name: Publish distribution 📦 to Test PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.TEST_PYPI_API_TOKEN }} repository_url: https://test.pypi.org/legacy/ deploy-pypi: name: Build and publish 📦 to PyPI if: startsWith(github.ref, 'refs/heads/main') runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup Python 3.9 uses: actions/setup-python@v4 with: python-version: "3.9" - name: Install pypa/build run: >- python -m pip install build --user - name: Build a binary wheel and a source tarball run: >- python -m build --sdist --wheel --outdir dist/ . - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.PYPI_API_TOKEN }}