Skip to content

chore(clients): correctly upgrade to maven central publishing #5085

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 8, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
release:
name: Publish to Sonatype
name: Publish to Maven Central
runs-on: ubuntu-22.04
if: "startsWith(github.event.head_commit.message, 'chore: release')"
steps:
Expand All @@ -26,8 +26,8 @@ jobs:
- name: Upload Artifacts
run: ./gradlew publishAllPublicationsToMavenCentral --no-configuration-cache
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_PRIVATE_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PRIVATE_KEY_PASSWORD }}
5 changes: 1 addition & 4 deletions clients/algoliasearch-client-java/api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ plugins {
}

repositories {
maven {
name = 'ossrh-staging-api'
url = "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"
}
maven { url = "https://oss.sonatype.org/content/repositories/" }
mavenCentral()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
publish:
name: Publish to Sonatype
name: Publish to Maven Central
runs-on: macos-14
if: "startsWith(github.event.head_commit.message, 'chore: release')"
steps:
Expand All @@ -26,8 +26,8 @@ jobs:
- name: Upload Artifacts
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_PRIVATE_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PRIVATE_KEY_PASSWORD }}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
release:
name: Publish to Sonatype
name: Publish to Maven Central
runs-on: ubuntu-22.04
if: "startsWith(github.event.head_commit.message, 'chore: release')"
steps:
Expand All @@ -24,23 +24,9 @@ jobs:
- name: Compile
run: sbt +compile

- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.SIGNING_PRIVATE_KEY }}
passphrase: ${{ secrets.SIGNING_PRIVATE_KEY_PASSWORD }}
fingerprint: ${{ secrets.SIGNING_PRIVATE_KEY_FINGERPRINT }}

- name: List GPG keys
run: gpg -K

- name: Publish Signed Artifacts
- run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.SIGNING_PRIVATE_KEY_PASSWORD }}
run: sbt +publishSigned

- name: Release Bundle to Sonatype
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
run: sbt sonatypeBundleRelease
PGP_SECRET_KEY: ${{ secrets.SIGNING_PRIVATE_KEY }}
SONATYPE_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
3 changes: 0 additions & 3 deletions clients/algoliasearch-client-scala/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name := "algoliasearch-scala"
description := "Scala client for Algolia Search API"
scalaVersion := "2.13.16"
crossScalaVersions := Seq("2.13.12", "3.6.3")
publishMavenStyle := true
Test / publishArtifact := false
licenses += ("MIT", url("https://opensource.org/licenses/MIT"))
homepage := Some(url("https://github.com/algolia/algoliasearch-client-scala/"))
Expand All @@ -23,8 +22,6 @@ developers += Developer(
url("https://github.com/algolia/algoliasearch-client-scala/")
)

publishTo := sonatypePublishToBundle.value

lazy val root = project
.in(file("."))
.enablePlugins(BuildInfoPlugin)
Expand Down
3 changes: 1 addition & 2 deletions clients/algoliasearch-client-scala/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.13.1")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.12.2")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.1")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.11.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.5")
3 changes: 1 addition & 2 deletions config/generation.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const patterns = [
'!clients/README.md',
'!clients/**/.openapi-generator-ignore',
'clients/**/.github/**',
'!clients/**/.github/workflows/release.yml',

// C#
'clients/algoliasearch-client-csharp/**',
Expand Down Expand Up @@ -38,7 +39,6 @@ export const patterns = [
'clients/algoliasearch-client-dart/packages/client_core/lib/src/version.dart',
'!clients/algoliasearch-client-dart/packages/*/lib/src/extension.dart',
'!clients/algoliasearch-client-dart/packages/algoliasearch/lib/algoliasearch.dart',
'!clients/algoliasearch-client-dart/.github/workflows/release.yml',

// GO
'clients/algoliasearch-client-go/algolia/**',
Expand All @@ -64,7 +64,6 @@ export const patterns = [
// JavaScript
'!clients/algoliasearch-client-javascript/*',
'!clients/algoliasearch-client-javascript/.yarn/**',
'!clients/algoliasearch-client-javascript/.github/workflows/release.yml',
'!clients/algoliasearch-client-javascript/scripts/**',
'!clients/algoliasearch-client-javascript/tests/**',
// the release process is allowed to push changes to this file, but in general we don't because those files are generated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,16 @@ private CodegenProperty innerFromProperty(
CodegenProperty property
) {
if (p == null) {
this.logger.severe("Undefined property/schema for `" + name + "`. Default to type:string.");
// this.logger.severe("Undefined property/schema for `" + name + "`. Default to
// type:string.");
return null;
} else {
this.logger.severe("debugging fromProperty for " + name + ": " + p);
// this.logger.severe("debugging fromProperty for " + name + ": " + p);
NamedSchema ns = new NamedSchema(name, p, required, schemaIsFromAdditionalProperties);
CodegenProperty cpc = (CodegenProperty) this.schemaCodegenPropertyCache.get(ns);
if (cpc != null) {
this.logger.info("Cached fromProperty for " + name + " : " + p.getName() + " required=" + required);
// this.logger.info("Cached fromProperty for " + name + " : " + p.getName() + " required=" +
// required);
return cpc;
} else {
Schema refToPropertiesSchema = ModelUtils.getSchemaFromRefToSchemaWithProperties(this.openAPI, p.get$ref());
Expand Down
9 changes: 5 additions & 4 deletions templates/java/gradle.properties.mustache
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
GROUP={{groupId}}
VERSION_NAME={{packageVersion}}

SONATYPE_HOST=DEFAULT
RELEASE_SIGNING_ENABLED=true
SONATYPE_AUTOMATIC_RELEASE=true

# POM
POM_DESCRIPTION=Java client for Algolia Search API
POM_URL=https://github.com/algolia/algoliasearch-client-java
Expand All @@ -19,3 +15,8 @@ POM_DEVELOPER_NAME=The Algolia Team
[email protected]
POM_ISSUE_SYSTEM=github
POM_ISSUE_URL=https://github.com/algolia/algoliasearch-client-java/issues

# Publishing
mavenCentralPublishing=true
mavenCentralAutomaticPublishing=true
signAllPublications=true
9 changes: 5 additions & 4 deletions templates/kotlin/gradle.properties.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ kotlin.mpp.stability.nowarn=true
GROUP={{groupId}}
VERSION_NAME={{packageVersion}}

# OSS
SONATYPE_HOST=DEFAULT
RELEASE_SIGNING_ENABLED=true

# POM
POM_DESCRIPTION="Algolia is a powerful search-as-a-service solution, made easy to use with API clients, UI libraries, \
and pre-built integrations. Algolia API Client for Kotlin lets you easily use the Algolia Search \
Expand All @@ -26,3 +22,8 @@ POM_DEVELOPER_NAME=The Algolia Team
[email protected]
POM_ISSUE_SYSTEM=github
POM_ISSUE_URL=https://github.com/algolia/algoliasearch-client-kotlin/issues

# Publishing
mavenCentralPublishing=true
mavenCentralAutomaticPublishing=true
signAllPublications=true