Skip to content

Commit 7191ff3

Browse files
committed
Move to Maven Central via Central Portal
1 parent 6381b7b commit 7191ff3

File tree

3 files changed

+49
-120
lines changed

3 files changed

+49
-120
lines changed

.github/workflows/ossrh-publish.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish to Maven Central
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Java
16+
uses: actions/setup-java@v4
17+
with:
18+
java-version: 17
19+
distribution: 'zulu'
20+
cache: gradle
21+
22+
- name: Check release validity
23+
run: bash .github/scripts/check-release.sh
24+
25+
- name: Grant execute permission for gradlew
26+
run: chmod +x gradlew
27+
28+
- name: Publish to Maven Central via Central Portal
29+
run: |
30+
./gradlew \
31+
uploadAllPublicationsToProjectLocalRepository \
32+
zipMavenCentralPortalPublication \
33+
releaseMavenCentralPortalPublication
34+
env:
35+
MAVEN_CENTRAL_PORTAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
36+
MAVEN_CENTRAL_PORTAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
37+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
38+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}

build.gradle

Lines changed: 11 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ plugins {
1212
id 'maven-publish'
1313
id 'signing'
1414
id 'jacoco'
15-
id 'io.github.gradle-nexus.publish-plugin' version "2.0.0"
15+
id 'org.danilopianini.publish-on-central' version "8.0.7"
1616
id "com.diffplug.spotless" version "6.13.0"
1717
}
1818

@@ -23,6 +23,8 @@ version = '0.14.5'
2323
java {
2424
sourceCompatibility = JavaVersion.VERSION_1_8
2525
targetCompatibility = JavaVersion.VERSION_1_8
26+
withJavadocJar()
27+
withSourcesJar()
2628
}
2729

2830
jacoco {
@@ -44,10 +46,6 @@ repositories {
4446
mavenCentral()
4547
}
4648

47-
configurations {
48-
testCompile.extendsFrom compileOnly
49-
}
50-
5149
dependencies {
5250
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
5351
implementation 'com.google.code.gson:gson:2.12.1'
@@ -78,19 +76,6 @@ dependencies {
7876
implementation 'com.auth0:java-jwt:4.5.0'
7977
}
8078

81-
task buildJar(type: Jar) {
82-
archiveBaseName = 'meilisearch-java'
83-
from {
84-
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
85-
}
86-
{
87-
exclude 'META-INF/*.SF'
88-
exclude 'META-INF/*.DSA'
89-
exclude 'META-INF/*.RSA'
90-
}
91-
with jar
92-
}
93-
9479
test {
9580
finalizedBy jacocoTestReport
9681
useJUnitPlatform {
@@ -122,70 +107,17 @@ task integrationTest(type: Test) {
122107
}
123108
}
124109

125-
java {
126-
withJavadocJar()
127-
withSourcesJar()
128-
}
129-
130-
publishing {
131-
publications {
132-
mavenJava(MavenPublication) {
133-
artifactId = 'meilisearch-java'
134-
from components.java
135-
pom {
136-
name = 'com.meilisearch.sdk:meilisearch-java'
137-
packaging = 'jar'
138-
artifactId = 'meilisearch-java'
139-
description = 'Meilisearch is a powerful, fast, open-source, easy to use and deploy search engine.'
140-
url = 'https://github.com/meilisearch/meilisearch-java'
141-
scm {
142-
connection = 'scm:git:git://github.com/meilisearch/meilisearch-java.git'
143-
developerConnection = 'scm:git:ssh://github.com:meilisearch/meilisearch-java.git'
144-
url = 'http://github.com/meilisearch/meilisearch-java'
145-
}
146-
licenses {
147-
license {
148-
name = 'MIT License'
149-
url = 'http://www.opensource.org/licenses/mit-license.php'
150-
}
151-
}
152-
developers {
153-
developer {
154-
id = 'eskombro'
155-
name = 'Samuel Jimenez'
156-
157-
}
158-
}
159-
}
160-
}
161-
}
162-
repositories {
163-
maven {
164-
url "https://oss.sonatype.org/service/local/staging/deploy/maven2"
165-
credentials {
166-
username System.getenv('OSSRH_USERNAME')
167-
password System.getenv('OSSRH_PASSWORD')
168-
}
169-
}
170-
}
171-
}
172-
173-
nexusPublishing {
174-
packageGroup = "com.meilisearch"
175-
176-
repositories {
177-
sonatype {
178-
nexusUrl.set(uri("https://oss.sonatype.org/service/local/"))
179-
180-
username = System.getenv('OSSRH_USERNAME')
181-
password = System.getenv('OSSRH_PASSWORD')
182-
stagingProfileId = System.getenv('SONATYPE_STAGING_PROFILE_ID')
183-
}
184-
}
110+
// New Maven Central Portal publishing configuration
111+
publishOnCentral {
112+
repoOwner.set("meilisearch")
113+
projectDescription.set("Meilisearch Java SDK")
185114
}
186115

187116
signing {
188-
sign publishing.publications.mavenJava
117+
useInMemoryPgpKeys(
118+
findProperty("signingKey")?.toString(),
119+
findProperty("signingPassword")?.toString()
120+
)
189121
}
190122

191123
javadoc {

0 commit comments

Comments
 (0)