Skip to content

Commit 6e339b9

Browse files
committed
Adjust publishing workflow
1 parent 7ec2e25 commit 6e339b9

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

.github/workflows/maven-publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Publish package
3131
uses: gradle/gradle-build-action@585b565652cefbba63202a7f927df0ff99f34001
3232
with:
33-
arguments: publish
33+
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository
3434
env:
3535
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
3636
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}

build.gradle.kts

+13-12
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ plugins {
1313
val adarshrTestLoggerVersion = "4.0.0"
1414
val sonarqubeVersion = "4.4.1.3373"
1515
val gradleReleasePluginVersion = "3.0.2"
16+
val gradleNexusPublishPluginVersion = "2.0.0-rc-2"
1617

1718
kotlin("jvm") version kotlinVersion
1819
id("io.spring.dependency-management") version springDependencyManagementVersion
@@ -23,6 +24,7 @@ plugins {
2324
id("maven-publish")
2425
id("signing")
2526
id("net.researchgate.release") version gradleReleasePluginVersion
27+
id("io.github.gradle-nexus.publish-plugin") version gradleNexusPublishPluginVersion
2628
}
2729

2830
group = "io.github.tobi-laa"
@@ -87,6 +89,17 @@ tasks.jacocoTestReport {
8789
}
8890
}
8991

92+
nexusPublishing {
93+
repositories {
94+
sonatype {
95+
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
96+
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
97+
username = System.getenv("OSSRH_USERNAME")
98+
password = System.getenv("OSSRH_TOKEN")
99+
}
100+
}
101+
}
102+
90103
publishing {
91104
publications {
92105
create<MavenPublication>("mavenJava") {
@@ -136,18 +149,6 @@ publishing {
136149
}
137150
}
138151
}
139-
repositories {
140-
maven {
141-
name = "ossrh"
142-
val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
143-
val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots")
144-
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
145-
credentials {
146-
username = System.getenv("OSSRH_USERNAME")
147-
password = System.getenv("OSSRH_TOKEN")
148-
}
149-
}
150-
}
151152
}
152153

153154
signing {

0 commit comments

Comments
 (0)