Skip to content

Commit a90890d

Browse files
authored
chore: update gradle build script to use jreleaser for packaging and release (#1205)
1 parent e78b263 commit a90890d

File tree

1 file changed

+55
-30
lines changed

1 file changed

+55
-30
lines changed

build.gradle.kts

+55-30
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
*/
1515

1616
import com.github.spotbugs.snom.Effort
17+
import org.jreleaser.model.Active
1718

1819
plugins {
1920
`java-library`
@@ -22,7 +23,7 @@ plugins {
2223
checkstyle
2324
jacoco
2425
id("com.github.spotbugs") version "6.0.8"
25-
id("io.codearte.nexus-staging") version "0.30.0"
26+
id("org.jreleaser") version "1.9.0"
2627
}
2728

2829
allprojects {
@@ -37,27 +38,6 @@ tasks["jar"].enabled = false
3738
val sonatypeUser: String? by project
3839
val sonatypePassword: String? by project
3940

40-
/*
41-
* Sonatype Staging Finalization
42-
* ====================================================
43-
*
44-
* When publishing to Maven Central, we need to close the staging
45-
* repository and release the artifacts after they have been
46-
* validated. This configuration is for the root project because
47-
* it operates at the "group" level.
48-
*/
49-
if (sonatypeUser != null && sonatypePassword != null) {
50-
apply(plugin = "io.codearte.nexus-staging")
51-
52-
nexusStaging {
53-
packageGroup = "software.amazon"
54-
stagingProfileId = "e789115b6c941"
55-
56-
username = sonatypeUser
57-
password = sonatypePassword
58-
}
59-
}
60-
6141
repositories {
6242
mavenLocal()
6343
mavenCentral()
@@ -140,12 +120,9 @@ subprojects {
140120

141121
publishing {
142122
repositories {
143-
mavenCentral {
144-
url = uri("https://aws.oss.sonatype.org/service/local/staging/deploy/maven2/")
145-
credentials {
146-
username = sonatypeUser
147-
password = sonatypePassword
148-
}
123+
maven {
124+
name = "stagingRepository"
125+
url = uri("${rootProject.buildDir}/staging")
149126
}
150127
}
151128

@@ -162,7 +139,7 @@ subprojects {
162139
pom {
163140
name.set(subproject.extra["displayName"].toString())
164141
description.set(subproject.description)
165-
url.set("https://github.com/awslabs/smithy")
142+
url.set("https://github.com/smithy-lang/smithy-typescript")
166143
licenses {
167144
license {
168145
name.set("Apache License 2.0")
@@ -180,7 +157,7 @@ subprojects {
180157
}
181158
}
182159
scm {
183-
url.set("https://github.com/awslabs/smithy.git")
160+
url.set("https://github.com/smithy-lang/smithy-typescript.git")
184161
}
185162
}
186163
}
@@ -259,3 +236,51 @@ subprojects {
259236
}
260237
}
261238
}
239+
240+
/*
241+
* Jreleaser (https://jreleaser.org) config.
242+
*/
243+
jreleaser {
244+
dryrun = false
245+
246+
// Used for creating a tagged release, uploading files and generating changelog.
247+
// In the future we can set this up to push release tags to GitHub, but for now it's
248+
// set up to do nothing.
249+
// https://jreleaser.org/guide/latest/reference/release/index.html
250+
release {
251+
generic {
252+
enabled = true
253+
skipRelease = true
254+
}
255+
}
256+
257+
// Used to announce a release to configured announcers.
258+
// https://jreleaser.org/guide/latest/reference/announce/index.html
259+
announce {
260+
active = Active.NEVER
261+
}
262+
263+
// Signing configuration.
264+
// https://jreleaser.org/guide/latest/reference/signing.html
265+
signing {
266+
active = Active.ALWAYS
267+
armored = true
268+
}
269+
270+
// Configuration for deploying to Maven Central.
271+
// https://jreleaser.org/guide/latest/examples/maven/maven-central.html#_gradle
272+
deploy {
273+
maven {
274+
nexus2 {
275+
create("maven-central") {
276+
active = Active.ALWAYS
277+
url = "https://aws.oss.sonatype.org/service/local"
278+
snapshotUrl = "https://aws.oss.sonatype.org/content/repositories/snapshots"
279+
closeRepository.set(true)
280+
releaseRepository.set(true)
281+
stagingRepositories.add("${rootProject.buildDir}/staging")
282+
}
283+
}
284+
}
285+
}
286+
}

0 commit comments

Comments
 (0)