diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..edd4a16 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,57 @@ +name: Publish to PyPI + +on: + push: + branches: + - main + +jobs: + build: + name: Build package + runs-on: ubuntu-latest + + permissions: + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + + - name: Install build + run: python -m pip install build + + - name: Build package + run: python -m build + + - name: Upload distributions + uses: actions/upload-artifact@v4 + with: + name: python-package + path: dist/ + + publish: + name: Publish to PyPI + runs-on: ubuntu-latest + + needs: build + + environment: + name: pypi + + permissions: + id-token: write + + steps: + - name: Download distributions + uses: actions/download-artifact@v4 + with: + name: python-package + path: dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file