Skip to content

Commit

Permalink
chore: use Jreleaser for codegen maven releases (#5910)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpmellema authored Mar 15, 2024
1 parent 343b066 commit 85ac6b4
Showing 1 changed file with 55 additions and 28 deletions.
83 changes: 55 additions & 28 deletions codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

import org.jreleaser.model.Active

plugins {
`java-library`
`maven-publish`
signing
checkstyle
jacoco
id("com.github.spotbugs") version "4.7.1"
id("io.codearte.nexus-staging") version "0.30.0"
id("org.jreleaser") version "1.9.0"
}

allprojects {
Expand All @@ -38,27 +41,6 @@ tasks["jar"].enabled = false
val sonatypeUser: String? by project
val sonatypePassword: String? by project

/*
* Sonatype Staging Finalization
* ====================================================
*
* When publishing to Maven Central, we need to close the staging
* repository and release the artifacts after they have been
* validated. This configuration is for the root project because
* it operates at the "group" level.
*/
if (sonatypeUser != null && sonatypePassword != null) {
apply(plugin = "io.codearte.nexus-staging")

nexusStaging {
packageGroup = "software.amazon"
stagingProfileId = "e789115b6c941"

username = sonatypeUser
password = sonatypePassword
}
}

repositories {
mavenLocal()
mavenCentral()
Expand Down Expand Up @@ -141,12 +123,9 @@ subprojects {

publishing {
repositories {
mavenCentral {
url = uri("https://aws.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = sonatypeUser
password = sonatypePassword
}
maven {
name = "stagingRepository"
url = uri("${rootProject.buildDir}/staging")
}
}

Expand Down Expand Up @@ -265,3 +244,51 @@ subprojects {
}
}
}

/*
* Jreleaser (https://jreleaser.org) config.
*/
jreleaser {
dryrun = false

// Used for creating a tagged release, uploading files and generating changelog.
// In the future we can set this up to push release tags to GitHub, but for now it's
// set up to do nothing.
// https://jreleaser.org/guide/latest/reference/release/index.html
release {
generic {
enabled = true
skipRelease = true
}
}

// Used to announce a release to configured announcers.
// https://jreleaser.org/guide/latest/reference/announce/index.html
announce {
active = Active.NEVER
}

// Signing configuration.
// https://jreleaser.org/guide/latest/reference/signing.html
signing {
active = Active.ALWAYS
armored = true
}

// Configuration for deploying to Maven Central.
// https://jreleaser.org/guide/latest/examples/maven/maven-central.html#_gradle
deploy {
maven {
nexus2 {
create("maven-central") {
active = Active.ALWAYS
url = "https://aws.oss.sonatype.org/service/local"
snapshotUrl = "https://aws.oss.sonatype.org/content/repositories/snapshots"
closeRepository.set(true)
releaseRepository.set(true)
stagingRepositories.add("${rootProject.buildDir}/staging")
}
}
}
}
}

0 comments on commit 85ac6b4

Please sign in to comment.