diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..c13b4c1 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,46 @@ +name: Publish to PyPI + +on: + workflow_dispatch: + +jobs: + build: + name: Build distributions + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Install build + run: python -m pip install build + - name: Build distributions + run: python -m build + - name: Check distributions + run: | + pip install twine + twine check dist/* + - name: Store distributions + uses: actions/upload-artifact@v4 + with: + name: pypi-dist + path: dist/ + + publish: + if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' + name: Publish to PyPI + needs: build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/project/neutro/ + permissions: + id-token: write # Required for OIDC + steps: + - name: Download distributions + uses: actions/download-artifact@v4 + with: + name: pypi-dist + path: dist/ + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1