This is an automated email from the ASF dual-hosted git repository.

jiayu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sedona.git


The following commit(s) were added to refs/heads/master by this push:
     new ae283fd9c7 [CI] Add the CI to publish to Pypi per GitHub release 
(#2588)
ae283fd9c7 is described below

commit ae283fd9c72e1e96173bfee529f2ae0fa369ba12
Author: Jia Yu <[email protected]>
AuthorDate: Fri Jan 9 00:12:21 2026 -0700

    [CI] Add the CI to publish to Pypi per GitHub release (#2588)
---
 .github/linters/zizmor.yml         |  1 +
 .github/workflows/python-wheel.yml | 55 +++++++++++++++++++++--
 docs/community/publish.md          | 92 +++-----------------------------------
 3 files changed, 58 insertions(+), 90 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
diff --git a/docs/community/publish.md b/docs/community/publish.md
index 557c459cb5..4880e9e40d 100644
--- a/docs/community/publish.md
+++ b/docs/community/publish.md
@@ -603,93 +603,11 @@ rm apache-sedona-{{ sedona_create_release.current_version 
}}-bin.tar.gz.sha512
 1. Click `Close` on the Sedona staging repo on https://repository.apache.org 
under `staging repository`
 2. Once the staging repo is closed, click `Release` on this repo.
 
-**NOTICE**: The staging repo will be automatically dropped after 3 days 
without closing. If you find the staging repo being dropped, you can re-stage 
the release using the following script.
+## 9. Release Sedona Python
 
-```bash
-#!/bin/bash
-
-echo "Re-staging releases to https://repository.apache.org";
-
-git checkout master
-git pull
-
-rm -f release.*
-rm -f pom.xml.*
-
-# Function to get Java version for Spark version
-get_java_version() {
-  local spark_version=$1
-  if [[ "$spark_version" == "4.0" ]]; then
-    echo "17"
-  else
-    echo "11"
-  fi
-}
-
-# Function to set JAVA_HOME based on Java version
-set_java_home() {
-  local java_version=$1
-  if [[ "$java_version" == "17" ]]; then
-    # Try to find Java 17 installation
-    if command -v /usr/libexec/java_home >/dev/null 2>&1; then
-      export JAVA_HOME=$(/usr/libexec/java_home -v 17 2>/dev/null || 
/usr/libexec/java_home -v 1.17 2>/dev/null || echo "")
-    fi
-    if [[ -z "$JAVA_HOME" ]]; then
-      echo "Warning: Java 17 not found, using system default"
-    else
-      echo "Using Java 17: $JAVA_HOME"
-    fi
-  else
-    # Try to find Java 11 installation
-    if command -v /usr/libexec/java_home >/dev/null 2>&1; then
-      export JAVA_HOME=$(/usr/libexec/java_home -v 11 2>/dev/null || 
/usr/libexec/java_home -v 1.11 2>/dev/null || echo "")
-    fi
-    if [[ -z "$JAVA_HOME" ]]; then
-      echo "Warning: Java 11 not found, using system default"
-    else
-      echo "Using Java 11: $JAVA_HOME"
-    fi
-  fi
-
-  # Verify Java version using Maven
-  echo "Verifying Java version with Maven..."
-  local mvn_java_version=$(mvn --version | grep "Java version" | sed 's/.*Java 
version: \([0-9]*\).*/\1/')
-  if [[ "$mvn_java_version" != "$java_version" ]]; then
-    echo "ERROR: Maven is using Java $mvn_java_version, but expected Java 
$java_version"
-    echo "Please ensure the correct Java version is installed and JAVA_HOME is 
set properly"
-    exit 1
-  fi
-  echo "✓ Verified: Maven is using Java $mvn_java_version"
-}
-
-# For Spark 3.4 and Scala 2.12 (Java 11)
-JAVA_VERSION=$(get_java_version "3.4")
-set_java_home $JAVA_VERSION
-mvn org.apache.maven.plugins:maven-release-plugin:2.3.2:perform 
-DconnectionUrl=scm:git:https://github.com/apache/sedona.git -Dtag={{ 
sedona_create_release.current_git_tag }} -Dresume=false 
-Darguments="-DskipTests -Dspark=3.4 -Dscala=2.12" -Dspark=3.4 -Dscala=2.12
-
-# For Spark 3.4 and Scala 2.13 (Java 11)
-mvn org.apache.maven.plugins:maven-release-plugin:2.3.2:perform 
-DconnectionUrl=scm:git:https://github.com/apache/sedona.git -Dtag={{ 
sedona_create_release.current_git_tag }} -Dresume=false 
-Darguments="-DskipTests -Dspark=3.4 -Dscala=2.13" -Dspark=3.4 -Dscala=2.13
-
-# For Spark 3.5 and Scala 2.12 (Java 11)
-JAVA_VERSION=$(get_java_version "3.5")
-set_java_home $JAVA_VERSION
-mvn org.apache.maven.plugins:maven-release-plugin:2.3.2:perform 
-DconnectionUrl=scm:git:https://github.com/apache/sedona.git -Dtag={{ 
sedona_create_release.current_git_tag }} -Dresume=false 
-Darguments="-DskipTests -Dspark=3.5 -Dscala=2.12" -Dspark=3.5 -Dscala=2.12
-
-# For Spark 3.5 and Scala 2.13 (Java 11)
-mvn org.apache.maven.plugins:maven-release-plugin:2.3.2:perform 
-DconnectionUrl=scm:git:https://github.com/apache/sedona.git -Dtag={{ 
sedona_create_release.current_git_tag }} -Dresume=false 
-Darguments="-DskipTests -Dspark=3.5 -Dscala=2.13" -Dspark=3.5 -Dscala=2.13
-
-# For Spark 4.0 and Scala 2.13 (Java 17)
-# Note: Spark 4.0 + Scala 2.12 is not supported, so we skip it
-JAVA_VERSION=$(get_java_version "4.0")
-set_java_home $JAVA_VERSION
-mvn org.apache.maven.plugins:maven-release-plugin:2.3.2:perform 
-DconnectionUrl=scm:git:https://github.com/apache/sedona.git -Dtag={{ 
sedona_create_release.current_git_tag }} -Dresume=false 
-Darguments="-DskipTests -Dspark=4.0 -Dscala=2.13" -Dspark=4.0 -Dscala=2.13
-```
-
-## 9. Release Sedona Python and Zeppelin
-
-You must have the maintainer privilege of 
`https://pypi.org/project/apache-sedona/` and 
`https://www.npmjs.com/package/apache-sedona`
+Sedona GitHub CI will automatically publish wheel files to PyPi once a GitHub 
release is created.
 
-To publish Sedona pythons, you have to use GitHub actions since we release 
wheels for different platforms. Please use this repo: 
https://github.com/jiayuasu/sedona-publish-python
+## 10. Release Sedona Zeppelin
 
 ```bash
 #!/bin/bash
@@ -705,7 +623,7 @@ cd apache-sedona-{{ sedona_create_release.current_version 
}}-src/zeppelin && npm
 rm -rf apache-sedona-{{ sedona_create_release.current_version }}-src
 ```
 
-## 10. Release Sedona R to CRAN.
+## 11. Release Sedona R to CRAN.
 
 ```bash
 #!/bin/bash
@@ -715,7 +633,7 @@ R CMD check --as-cran apache.sedona_*.tar.gz
 
 Then submit to CRAN using this [web 
form](https://xmpalantir.wu.ac.at/cransubmit/).
 
-## 11. Publish the doc website
+## 12. Publish the doc website
 
 1. Check out the {{ sedona_create_release.current_version }} Git tag on your 
local repo to a branch namely `branch-{{ sedona_create_release.current_version 
}}`
 2. Add the download link to [Download page](../download.md).

Reply via email to