ci: enable java auto release (#1602)

Enable bump java pom.xml versions
Enable auto java release when detect stable github release
This commit is contained in:
LuQQiu
2024-09-19 10:51:03 -07:00
committed by GitHub
parent abeaae3d80
commit e118c37228
7 changed files with 68 additions and 36 deletions

View File

@@ -24,34 +24,56 @@ commit = true
message = "Bump version: {current_version} → {new_version}" message = "Bump version: {current_version} → {new_version}"
commit_args = "" 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] [tool.bumpversion.parts.pre_l]
values = ["beta", "final"]
optional_value = "final" optional_value = "final"
values = ["beta", "final"]
[[tool.bumpversion.files]] [[tool.bumpversion.files]]
filename = "node/package.json" filename = "node/package.json"
search = "\"version\": \"{current_version}\","
replace = "\"version\": \"{new_version}\"," replace = "\"version\": \"{new_version}\","
search = "\"version\": \"{current_version}\","
[[tool.bumpversion.files]] [[tool.bumpversion.files]]
filename = "nodejs/package.json" filename = "nodejs/package.json"
search = "\"version\": \"{current_version}\","
replace = "\"version\": \"{new_version}\"," replace = "\"version\": \"{new_version}\","
search = "\"version\": \"{current_version}\","
# nodejs binary packages # nodejs binary packages
[[tool.bumpversion.files]] [[tool.bumpversion.files]]
glob = "nodejs/npm/*/package.json" glob = "nodejs/npm/*/package.json"
search = "\"version\": \"{current_version}\","
replace = "\"version\": \"{new_version}\"," replace = "\"version\": \"{new_version}\","
search = "\"version\": \"{current_version}\","
# Cargo files # Cargo files
# ------------ # ------------
[[tool.bumpversion.files]] [[tool.bumpversion.files]]
filename = "rust/ffi/node/Cargo.toml" filename = "rust/ffi/node/Cargo.toml"
search = "\nversion = \"{current_version}\""
replace = "\nversion = \"{new_version}\"" replace = "\nversion = \"{new_version}\""
search = "\nversion = \"{current_version}\""
[[tool.bumpversion.files]] [[tool.bumpversion.files]]
filename = "rust/lancedb/Cargo.toml" filename = "rust/lancedb/Cargo.toml"
search = "\nversion = \"{current_version}\""
replace = "\nversion = \"{new_version}\"" replace = "\nversion = \"{new_version}\""
search = "\nversion = \"{current_version}\""

View File

@@ -94,11 +94,16 @@ jobs:
mkdir -p ./core/target/classes/nativelib/darwin-aarch64 ./core/target/classes/nativelib/linux-aarch64 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_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 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 - name: Set github
run: | run: |
git config --global user.email "LanceDB Github Runner" git config --global user.email "LanceDB Github Runner"
git config --global user.name "dev+gha@lancedb.com" git config --global user.name "dev+gha@lancedb.com"
- name: Publish with Java 8 - name: Publish with Java 8
if: github.event_name == 'release'
run: | run: |
echo "use-agent" >> ~/.gnupg/gpg.conf echo "use-agent" >> ~/.gnupg/gpg.conf
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf

View File

@@ -30,7 +30,7 @@ on:
default: true default: true
type: boolean type: boolean
other: other:
description: 'Make a Node/Rust release' description: 'Make a Node/Rust/Java release'
required: true required: true
default: true default: true
type: boolean type: boolean

View File

@@ -2,7 +2,7 @@
name = "lancedb-jni" name = "lancedb-jni"
description = "JNI bindings for LanceDB" description = "JNI bindings for LanceDB"
# TODO modify lancedb/Cargo.toml for version and dependencies # TODO modify lancedb/Cargo.toml for version and dependencies
version = "0.4.18" version = "0.10.0"
edition.workspace = true edition.workspace = true
repository.workspace = true repository.workspace = true
readme.workspace = true readme.workspace = true

View File

@@ -8,7 +8,7 @@
<parent> <parent>
<groupId>com.lancedb</groupId> <groupId>com.lancedb</groupId>
<artifactId>lancedb-parent</artifactId> <artifactId>lancedb-parent</artifactId>
<version>0.0.3</version> <version>0.10.0</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@@ -44,7 +44,7 @@
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId> <artifactId>junit-jupiter</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@@ -6,7 +6,7 @@
<groupId>com.lancedb</groupId> <groupId>com.lancedb</groupId>
<artifactId>lancedb-parent</artifactId> <artifactId>lancedb-parent</artifactId>
<version>0.0.3</version> <version>0.10.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>LanceDB Parent</name> <name>LanceDB Parent</name>
@@ -92,7 +92,7 @@
</repository> </repository>
</distributionManagement> </distributionManagement>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@@ -167,7 +167,8 @@
<version>3.2.5</version> <version>3.2.5</version>
<configuration> <configuration>
<argLine>--add-opens=java.base/java.nio=ALL-UNNAMED</argLine> <argLine>--add-opens=java.base/java.nio=ALL-UNNAMED</argLine>
<forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/> <forkNode
implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory" />
<useSystemClassLoader>false</useSystemClassLoader> <useSystemClassLoader>false</useSystemClassLoader>
</configuration> </configuration>
</plugin> </plugin>
@@ -183,7 +184,7 @@
</pluginManagement> </pluginManagement>
</build> </build>
<profiles> <profiles>
<profile> <profile>
<id>jdk8</id> <id>jdk8</id>
<activation> <activation>
@@ -210,7 +211,8 @@
<version>3.2.5</version> <version>3.2.5</version>
<configuration> <configuration>
<argLine>--add-opens=java.base/java.nio=ALL-UNNAMED</argLine> <argLine>--add-opens=java.base/java.nio=ALL-UNNAMED</argLine>
<forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory" /> <forkNode
implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory" />
<useSystemClassLoader>false</useSystemClassLoader> <useSystemClassLoader>false</useSystemClassLoader>
</configuration> </configuration>
</plugin> </plugin>

View File

@@ -1,11 +1,11 @@
# Release process # Release process
There are five total packages we release. Three are the `lancedb` packages There are five total packages we release. Four are the `lancedb` packages
for Python, Rust, and Node.js. The other two are the legacy `vectordb` for Python, Rust, Java, and Node.js. The other one is the legacy `vectordb`
packages for Rust and node.js. package node.js.
The Python package is versioned and released separately from the Rust and Node.js The Python package is versioned and released separately from the Rust, Java, and Node.js
ones. For Rust and Node.js, the release process is shared between `lancedb` and ones. For Node.js the release process is shared between `lancedb` and
`vectordb` for now. `vectordb` for now.
## Preview releases ## Preview releases
@@ -36,7 +36,10 @@ The release process uses a handful of GitHub actions to automate the process.
│ └───────────┘ │ │ └───────────┘ │
│ └──►NPM Packages │ └──►NPM Packages
│ ┌─────────────┐ │ ┌─────────────┐
──────►│Cargo Publish├───►Cargo Release ──────►│Cargo Publish├───►Cargo Release
│ └─────────────┘
│ ┌─────────────┐
└──────►│Maven Publish├───►Java Maven Repo Release
└─────────────┘ └─────────────┘
``` ```