diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..041c6e6 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,49 @@ +name: publish + +on: + push: + tags: + - '[0-9]+.[0-9]+.[0-9]+' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + +jobs: + build: + name: Build a pure Python wheel and source distribution + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install build dependencies + run: python -m pip install --upgrade build + + - name: Build + run: python -m build + + - uses: actions/upload-artifact@v3 + with: + name: artifacts + path: dist/* + if-no-files-found: error + + publish: + name: Publish release + runs-on: ubuntu-latest + needs: + - build + + steps: + - uses: actions/download-artifact@v3 + with: + name: artifacts + path: dist + + - name: Push build artifacts to PyPI + uses: pypa/gh-action-pypi-publish@v1.5.0 + with: + skip_existing: true + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }}