From e118c37228ba03d060c1476280fa18fbbc007830 Mon Sep 17 00:00:00 2001 From: LuQQiu Date: Thu, 19 Sep 2024 10:51:03 -0700 Subject: [PATCH] ci: enable java auto release (#1602) Enable bump java pom.xml versions Enable auto java release when detect stable github release --- .bumpversion.toml | 34 ++++++++++++++--- .github/workflows/java-publish.yml | 5 +++ .github/workflows/make-release-commit.yml | 2 +- java/core/lancedb-jni/Cargo.toml | 2 +- java/core/pom.xml | 4 +- java/pom.xml | 12 +++--- release_process.md | 45 ++++++++++++----------- 7 files changed, 68 insertions(+), 36 deletions(-) diff --git a/.bumpversion.toml b/.bumpversion.toml index 49c7b84f..8399aedc 100644 --- a/.bumpversion.toml +++ b/.bumpversion.toml @@ -24,34 +24,56 @@ commit = true message = "Bump version: {current_version} → {new_version}" commit_args = "" +# Java maven files +pre_commit_hooks = [ + """ + NEW_VERSION="${BVHOOK_NEW_MAJOR}.${BVHOOK_NEW_MINOR}.${BVHOOK_NEW_PATCH}" + if [ ! -z "$BVHOOK_NEW_PRE_L" ] && [ ! -z "$BVHOOK_NEW_PRE_N" ]; then + NEW_VERSION="${NEW_VERSION}-${BVHOOK_NEW_PRE_L}.${BVHOOK_NEW_PRE_N}" + fi + echo "Constructed new version: $NEW_VERSION" + cd java && mvn versions:set -DnewVersion=$NEW_VERSION && mvn versions:commit + + # Check for any modified but unstaged pom.xml files + MODIFIED_POMS=$(git ls-files -m | grep pom.xml) + if [ ! -z "$MODIFIED_POMS" ]; then + echo "The following pom.xml files were modified but not staged. Adding them now:" + echo "$MODIFIED_POMS" | while read -r file; do + git add "$file" + echo "Added: $file" + done + fi + """, +] + [tool.bumpversion.parts.pre_l] -values = ["beta", "final"] optional_value = "final" +values = ["beta", "final"] [[tool.bumpversion.files]] filename = "node/package.json" -search = "\"version\": \"{current_version}\"," replace = "\"version\": \"{new_version}\"," +search = "\"version\": \"{current_version}\"," [[tool.bumpversion.files]] filename = "nodejs/package.json" -search = "\"version\": \"{current_version}\"," replace = "\"version\": \"{new_version}\"," +search = "\"version\": \"{current_version}\"," # nodejs binary packages [[tool.bumpversion.files]] glob = "nodejs/npm/*/package.json" -search = "\"version\": \"{current_version}\"," replace = "\"version\": \"{new_version}\"," +search = "\"version\": \"{current_version}\"," # Cargo files # ------------ [[tool.bumpversion.files]] filename = "rust/ffi/node/Cargo.toml" -search = "\nversion = \"{current_version}\"" replace = "\nversion = \"{new_version}\"" +search = "\nversion = \"{current_version}\"" [[tool.bumpversion.files]] filename = "rust/lancedb/Cargo.toml" -search = "\nversion = \"{current_version}\"" replace = "\nversion = \"{new_version}\"" +search = "\nversion = \"{current_version}\"" diff --git a/.github/workflows/java-publish.yml b/.github/workflows/java-publish.yml index 12d13522..93c22efa 100644 --- a/.github/workflows/java-publish.yml +++ b/.github/workflows/java-publish.yml @@ -94,11 +94,16 @@ jobs: mkdir -p ./core/target/classes/nativelib/darwin-aarch64 ./core/target/classes/nativelib/linux-aarch64 cp ../liblancedb_jni_darwin_aarch64.zip/liblancedb_jni.dylib ./core/target/classes/nativelib/darwin-aarch64/liblancedb_jni.dylib cp ../liblancedb_jni_linux_aarch64.zip/liblancedb_jni.so ./core/target/classes/nativelib/linux-aarch64/liblancedb_jni.so + - name: Dry run + if: github.event_name == 'pull_request' + run: | + mvn --batch-mode -DskipTests package - name: Set github run: | git config --global user.email "LanceDB Github Runner" git config --global user.name "dev+gha@lancedb.com" - name: Publish with Java 8 + if: github.event_name == 'release' run: | echo "use-agent" >> ~/.gnupg/gpg.conf echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf diff --git a/.github/workflows/make-release-commit.yml b/.github/workflows/make-release-commit.yml index 9a9e2be6..2fd70646 100644 --- a/.github/workflows/make-release-commit.yml +++ b/.github/workflows/make-release-commit.yml @@ -30,7 +30,7 @@ on: default: true type: boolean other: - description: 'Make a Node/Rust release' + description: 'Make a Node/Rust/Java release' required: true default: true type: boolean diff --git a/java/core/lancedb-jni/Cargo.toml b/java/core/lancedb-jni/Cargo.toml index ad9381f5..6fa63fba 100644 --- a/java/core/lancedb-jni/Cargo.toml +++ b/java/core/lancedb-jni/Cargo.toml @@ -2,7 +2,7 @@ name = "lancedb-jni" description = "JNI bindings for LanceDB" # TODO modify lancedb/Cargo.toml for version and dependencies -version = "0.4.18" +version = "0.10.0" edition.workspace = true repository.workspace = true readme.workspace = true diff --git a/java/core/pom.xml b/java/core/pom.xml index b6fedc19..ec6f63c9 100644 --- a/java/core/pom.xml +++ b/java/core/pom.xml @@ -8,7 +8,7 @@ com.lancedb lancedb-parent - 0.0.3 + 0.10.0 ../pom.xml @@ -44,7 +44,7 @@ org.junit.jupiter junit-jupiter - test + test diff --git a/java/pom.xml b/java/pom.xml index 6a0a95a7..2b3a92ea 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -6,7 +6,7 @@ com.lancedb lancedb-parent - 0.0.3 + 0.10.0 pom LanceDB Parent @@ -92,7 +92,7 @@ - + org.apache.maven.plugins @@ -167,7 +167,8 @@ 3.2.5 --add-opens=java.base/java.nio=ALL-UNNAMED - + false @@ -183,7 +184,7 @@ - + jdk8 @@ -210,7 +211,8 @@ 3.2.5 --add-opens=java.base/java.nio=ALL-UNNAMED - + false diff --git a/release_process.md b/release_process.md index 979cb8db..6df46962 100644 --- a/release_process.md +++ b/release_process.md @@ -1,11 +1,11 @@ # Release process -There are five total packages we release. Three are the `lancedb` packages -for Python, Rust, and Node.js. The other two are the legacy `vectordb` -packages for Rust and node.js. +There are five total packages we release. Four are the `lancedb` packages +for Python, Rust, Java, and Node.js. The other one is the legacy `vectordb` +package node.js. -The Python package is versioned and released separately from the Rust and Node.js -ones. For Rust and Node.js, the release process is shared between `lancedb` and +The Python package is versioned and released separately from the Rust, Java, and Node.js +ones. For Node.js the release process is shared between `lancedb` and `vectordb` for now. ## Preview releases @@ -24,20 +24,23 @@ indexes. The release process uses a handful of GitHub actions to automate the process. ```text - ┌─────────────────────┐ - │Create Release Commit│ - └─┬───────────────────┘ - │ ┌────────────┐ ┌──►Python GH Release - ├──►(tag) python-vX.Y.Z ───►│PyPI Publish├─┤ - │ └────────────┘ └──►Python Wheels - │ - │ ┌───────────┐ - └──►(tag) vX.Y.Z ───┬──────►│NPM Publish├──┬──►Rust/Node GH Release - │ └───────────┘ │ - │ └──►NPM Packages - │ ┌─────────────┐ - └──────►│Cargo Publish├───►Cargo Release - └─────────────┘ + ┌─────────────────────┐ + │Create Release Commit│ + └─┬───────────────────┘ + │ ┌────────────┐ ┌──►Python GH Release + ├──►(tag) python-vX.Y.Z ───►│PyPI Publish├─┤ + │ └────────────┘ └──►Python Wheels + │ + │ ┌───────────┐ + └──►(tag) vX.Y.Z ───┬──────►│NPM Publish├──┬──►Rust/Node GH Release + │ └───────────┘ │ + │ └──►NPM Packages + │ ┌─────────────┐ + ├──────►│Cargo Publish├───►Cargo Release + │ └─────────────┘ + │ ┌─────────────┐ + └──────►│Maven Publish├───►Java Maven Repo Release + └─────────────┘ ``` To start a release, trigger a `Create Release Commit` action from @@ -56,10 +59,10 @@ To start a release, trigger a `Create Release Commit` action from ## Breaking changes We try to avoid breaking changes, but sometimes they are necessary. When there -are breaking changes, we will increment the minor version. (This is valid +are breaking changes, we will increment the minor version. (This is valid semantic versioning because we are still in `0.x` versions.) -When a PR makes a breaking change, the PR author should mark the PR using the +When a PR makes a breaking change, the PR author should mark the PR using the conventional commit markers: either exclamation mark after the type (such as `feat!: change signature of func`) or have `BREAKING CHANGE` in the body of the PR. A CI job will add a `breaking-change` label to the PR, which is