name: Python Package on: push: branches: - '*' tags: - '*' jobs: build: runs-on: ubuntu-latest name: Wheel steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 submodules: 'recursive' - name: Set up Python uses: actions/setup-python@v2 with: python-version: "3.9" - name: Install Python packages run: python -m pip install --upgrade build pip - name: build wheel run: python -m build --wheel - name: build sdist run: python -m build --sdist - name: Store the packages uses: actions/upload-artifact@v2 with: name: python-package-distributions path: dist pypi: runs-on: 'ubuntu-latest' needs: - build steps: - name: Download all the dists uses: actions/download-artifact@v2 with: name: python-package-distributions path: dist/ - name: Publish 📦 to TestPyPI if: ${{ github.ref == 'refs/heads/patcher' }} uses: pypa/gh-action-pypi-publish@master with: password: ${{ secrets.testpypi_password }} repository_url: https://test.pypi.org/legacy/ - name: Publish 📦 to PyPI if: ${{ startsWith(github.ref, 'refs/tags/') }} uses: pypa/gh-action-pypi-publish@master with: password: ${{ secrets.pypi_password }}