This is an automated email from the ASF dual-hosted git repository. jiayu pushed a commit to branch publish-to-pypi in repository https://gitbox.apache.org/repos/asf/sedona.git
commit 87b0e83fd801c1701f10b9f431e25ac9db1885c8 Author: Jia Yu <[email protected]> AuthorDate: Thu Jan 8 22:38:13 2026 -0800 Add the CI to publish to Pypi per release --- .github/linters/zizmor.yml | 1 + .github/workflows/python-wheel.yml | 55 +++++++++++++++++++++++++++++++++++--- 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/.github/linters/zizmor.yml b/.github/linters/zizmor.yml index 08d06108ff..f98fe2118a 100644 --- a/.github/linters/zizmor.yml +++ b/.github/linters/zizmor.yml @@ -24,6 +24,7 @@ rules: docker/setup-qemu-action: any github/*: any pypa/cibuildwheel: any + pypa/gh-action-pypi-publish: any r-lib/actions/check-r-package: any r-lib/actions/setup-r: any r-lib/actions/setup-r-dependencies: any diff --git a/.github/workflows/python-wheel.yml b/.github/workflows/python-wheel.yml index 28cd25ee74..7faea6d03d 100644 --- a/.github/workflows/python-wheel.yml +++ b/.github/workflows/python-wheel.yml @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -name: Python build wheels +name: Python build and publish wheels on: push: @@ -38,6 +38,9 @@ on: - 'pom.xml' - 'python/**' - '.github/workflows/python-wheel.yml' + release: + types: + - published permissions: contents: read @@ -47,7 +50,8 @@ concurrency: cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} jobs: - build: + build_wheels: + name: Build wheels on ${{ matrix.os }} strategy: matrix: os: ['ubuntu-latest', 'windows-latest', 'macos-latest'] @@ -68,7 +72,7 @@ jobs: image: tonistiigi/binfmt:qemu-v8.1.5 platforms: all - name: Build wheels - uses: pypa/[email protected] + uses: pypa/[email protected] env: CIBW_SKIP: 'pp* *musl*' CIBW_ARCHS_LINUX: 'x86_64 aarch64' @@ -80,3 +84,48 @@ jobs: with: name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} path: ./wheelhouse/*.whl + + build_sdist: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + + - name: Install uv + uses: astral-sh/setup-uv@v4 + + - name: Build sdist + run: cd python && uv build --sdist + + - uses: actions/upload-artifact@v6 + with: + name: cibw-sdist + path: python/dist/*.tar.gz + + upload_pypi: + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + # publish when a GitHub Release is created + if: github.event_name == 'release' && github.event.action == 'published' + environment: pypi + permissions: + id-token: write # IMPORTANT: mandatory for Trusted Publishing + steps: + - uses: actions/download-artifact@v6 + with: + # unpacks wheel files into artifacts + pattern: cibw-* + merge-multiple: false + path: artifacts + - name: Copy everything to the dist folder + run: | + mkdir -p dist + for pattern in artifacts/cibw-sdist/* artifacts/cibw-wheels-macos-*/* artifacts/cibw-wheels-ubuntu-*/* artifacts/cibw-wheels-windows-*/*; do + cp -r $pattern dist 2>/dev/null || echo "No files matched $pattern" + done + echo "Content copied to dist." + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + # repository_url: https://test.pypi.org/legacy/ # to test
