Skip to content

Commit 157d2b6

Browse files
committed
Release Jervis 2.1
1 parent 070f5ad commit 157d2b6

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

build.gradle

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,14 @@ task testSourcesJar(type: Jar) {
170170
from sourceSets.test.allSource
171171
}
172172

173+
task mainSourcesJar(type: Jar) {
174+
archiveClassifier = 'sources'
175+
includes = ['**/*']
176+
from sourceSets.main.allSource
177+
}
178+
173179
artifacts {
174-
archives javadocJar, testJar, testSourcesJar
180+
archives mainSourcesJar, javadocJar, testJar, testSourcesJar
175181
}
176182

177183
jar {
@@ -186,8 +192,9 @@ jar {
186192
publishing {
187193
repositories {
188194
maven {
189-
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
190-
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
195+
// https://central.sonatype.org/publish/publish-portal-ossrh-staging-api/
196+
def releasesRepoUrl = "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"
197+
def snapshotsRepoUrl = "https://central.sonatype.com/repository/maven-snapshots/"
191198
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
192199
credentials {
193200
username = ossrhUsername
@@ -201,6 +208,7 @@ publishing {
201208
}
202209
binaryAndSources(MavenPublication) {
203210
from components.java
211+
artifact mainSourcesJar
204212
artifact javadocJar
205213
artifact testJar
206214
artifact testSourcesJar
@@ -332,5 +340,27 @@ task mockVault(dependsOn: "classes", type: JavaExec) {
332340
task mockAll
333341
mockAll.dependsOn mockVault
334342

343+
/**
344+
Maven Central publishing notification.
345+
*/
346+
task postToNotifyMavenCentral {
347+
doLast {
348+
// https://central.sonatype.org/publish/publish-portal-ossrh-staging-api/#documentation-of-manual-api-endpoints
349+
// https://ossrh-staging-api.central.sonatype.com/swagger-ui/#/default/manual_upload_default_repository
350+
new URL('https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/net.gleske').openConnection().with { conn ->
351+
conn.setConnectTimeout(10000)
352+
conn.setRequestProperty('Authorization', 'Bearer ' + "${ossrhUsername}:${ossrhPassword}".toString().bytes.encodeBase64().toString())
353+
conn.setRequestMethod('POST')
354+
// make network request
355+
conn.getHeaderFields()
356+
}
357+
}
358+
}
359+
afterEvaluate {
360+
tasks.named('publishBinaryAndSourcesPublicationToMavenRepository') {
361+
finalizedBy 'postToNotifyMavenCentral'
362+
}
363+
}
364+
335365
//http://www.gradle.org/docs/current/userguide/gradle_wrapper.html
336366
//generate gradlew with: ./gradlew wrapper --gradle-version 7.6

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=2.1-SNAPSHOT
1+
version=2.1

0 commit comments

Comments
 (0)