Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/workflows/publish-maven-central.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Publish to Maven Central

on:
workflow_dispatch:
inputs:
version:
description: 'Version to release'
required: true
default: '0.1.0'
type: string

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'zulu'
cache: 'maven'

- name: Install GPG
run: |
sudo apt-get update
sudo apt-get install -y gnupg

- name: Import GPG key
run: |
echo "${{ secrets.GPG_PRIVATE_KEY }}" | base64 -d > private.key
gpg --batch --import private.key
rm private.key
echo "GPG key imported successfully"
gpg --list-keys

- name: Configure Maven settings
run: |
mkdir -p ~/.m2
cat > ~/.m2/settings.xml << EOF
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>central</id>
<username>${{ secrets.CENTRAL_USERNAME }}</username>
<password>${{ secrets.CENTRAL_PASSWORD }}</password>
</server>
</servers>
<profiles>
<profile>
<id>sign-artifacts</id>
<properties>
<gpg.passphrase>${{ secrets.GPG_PASSPHRASE }}</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
EOF

- name: Update version in pom.xml
run: |
cd clients/java
mvn versions:set -DnewVersion=${{ github.event.inputs.version }}
mvn versions:commit

- name: Build and publish to Maven Central
run: |
cd clients/java
mvn clean deploy -Psign-artifacts -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" --batch-mode
env:
GPG_TTY: ''
GPG_AGENT_INFO: /dev/null
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Upload build artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: maven-artifacts
path: |
clients/java/target/*.jar
clients/java/target/*.pom
clients/java/target/*.asc
retention-days: 1
110 changes: 88 additions & 22 deletions clients/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<url>https://github.com/openkruise/agents-api</url>

<prerequisites>
<maven>2.2.0</maven>
<maven>3.6.0</maven>
</prerequisites>

<scm>
Expand All @@ -27,23 +27,21 @@
</license>
</licenses>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<developers>
<developer>
<name>Qing Zhao</name>
<email>zq01297892@alibaba-inc.com</email>
<organization>openkruise</organization>
<organizationUrl>https://github.com/openkruise/agents-api</organizationUrl>
</developer>
</developers>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<version>3.0.0</version>
<configuration>
<systemProperties>
<property>
Expand All @@ -52,12 +50,11 @@
</property>
</systemProperties>
<argLine>-Xms512m -Xmx1500m</argLine>
<parallel>methods</parallel>
<forkMode>pertest</forkMode>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.1</version>
<executions>
<execution>
<phase>package</phase>
Expand All @@ -75,23 +72,30 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<version>3.3.0</version>
<executions>
<execution>
<id>default-jar</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
<execution>
<id>test-jar</id>
<goals>
<goal>test-jar</goal>
</goals>
<configuration>
<classifier>tests</classifier>
</configuration>
</execution>
</executions>
<configuration>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.10</version>
<version>3.5.0</version>
<executions>
<execution>
<id>add_sources</id>
Expand Down Expand Up @@ -122,7 +126,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<version>3.6.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -135,7 +139,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -145,6 +149,18 @@
</execution>
</executions>
</plugin>
<!-- Central Publishing Plugin for Maven Central -->
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.9.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<tokenAuth>true</tokenAuth>
<autoPublish>true</autoPublish>
</configuration>
</plugin>
</plugins>
</build>

Expand All @@ -156,14 +172,20 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<version>3.1.0</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
Expand Down Expand Up @@ -200,6 +222,48 @@
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
<!-- gRPC -->
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
<version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-api</artifactId>
<version>${grpc.version}</version>
</dependency>
<!-- Protobuf -->
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>${protobuf.version}</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>${protobuf.version}</version>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.6</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1.1</version>
</dependency>
</dependencies>

<properties>
Expand All @@ -208,8 +272,10 @@
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<swagger-core-version>1.5.15</swagger-core-version>
<gson-version>2.8.1</gson-version>
<gson-version>2.10.1</gson-version>
<jodatime-version>2.9.9</jodatime-version>
<grpc.version>1.60.0</grpc.version>
<protobuf.version>4.34.0</protobuf.version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.13.1</junit-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Loading