Skip to content
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

use jreleaser for maven publish #154

Merged
merged 1 commit into from
Jul 29, 2024
Merged
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
77 changes: 50 additions & 27 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ plugins {

id "maven-publish"
id "signing"
id "io.codearte.nexus-staging" version "0.30.0"
id "com.palantir.git-version" version "0.12.3"
id "checkstyle"
id "org.jreleaser" version "1.13.0"
}


Expand Down Expand Up @@ -73,6 +73,8 @@ ext {

println "Smithy Language Server version: '${libraryVersion}'"

def stagingDirectory = rootProject.layout.buildDirectory.dir("staging")

allprojects {
apply plugin: "java"
apply plugin: "maven-publish"
Expand All @@ -89,14 +91,9 @@ repositories {

publishing {
repositories {
mavenCentral {
url = uri("https://aws.oss.sonatype.org/service/local/staging/deploy/maven2/")
if (project.hasProperty("sonatypeUser")) {
credentials {
username = project.property("sonatypeUser")
password = project.property("sonatypePassword")
}
}
maven {
name = "localStaging"
url = stagingDirectory
}
}

Expand All @@ -118,7 +115,7 @@ publishing {
pom {
name.set("Smithy Language Server")
description.set(project.description)
url.set("https://github.com/awslabs/smithy-language-server")
url.set("https://github.com/smithy-lang/smithy-language-server")
licenses {
license {
name.set("Apache License 2.0")
Expand All @@ -136,7 +133,7 @@ publishing {
}
}
scm {
url.set("https://github.com/awslabs/smithy-language-server.git")
url.set("https://github.com/smithy-lang/smithy-language-server.git")
}
}
}
Expand Down Expand Up @@ -233,21 +230,47 @@ jar {
}
}

/*
* 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 (project.hasProperty("sonatypeUser") && project.hasProperty("sonatypePassword")) {
apply plugin: "io.codearte.nexus-staging"
nexusStaging {
packageGroup = "software.amazon"
stagingProfileId = "e789115b6c941"
username = project.property("sonatypeUser")
password = project.property("sonatypePassword")
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 = "NEVER"
}

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

// Configuration for deploying to Maven Central.
// https://jreleaser.org/guide/latest/examples/maven/maven-central.html#_gradle
deploy {
maven {
nexus2 {
"maven-central" {
active = "ALWAYS"
url = "https://aws.oss.sonatype.org/service/local"
snapshotUrl = "https://aws.oss.sonatype.org/content/repositories/snapshots"
closeRepository = true
releaseRepository = true
stagingRepository(stagingDirectory.get().toString())
}
}
}
}
}
Loading