Skip to content

Commit

Permalink
update publish plugin to use the Portal Publisher API
Browse files Browse the repository at this point in the history
  • Loading branch information
12rcu committed Jul 21, 2024
1 parent aff6b28 commit 0eebd22
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/monstera-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Publish to Maven Central
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
with:
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository
arguments: jreleaserConfig clean publish jreleaserFullRelease
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
Expand Down
47 changes: 24 additions & 23 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
plugins {
kotlin("jvm") version "2.0.0"
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
`maven-publish`
signing
`java-library`
id("org.jreleaser") version "1.13.1"
}

group = "com.lotsofpixelsstudios"
/*group = "com.lotsofpixelsstudios"*/
group = "de.matthiasklenz"
version = System.getenv("GITHUB_REF")?.removePrefix("refs/tags/") ?: "local" //use tag name as version

dependencies {
Expand Down Expand Up @@ -34,19 +35,6 @@ java {
withSourcesJar()
}

signing {
gradle.taskGraph.whenReady {
isRequired = allTasks.any { it is PublishToMavenRepository }
}

useInMemoryPgpKeys(
System.getenv("ORG_GRADLE_PROJECT_signingKey"),
System.getenv("ORG_GRADLE_PROJECT_signingPassword")
)

sign(publishing.publications)
}

//set the version in the resource files to access it from projects
gradle.taskGraph.whenReady {
layout
Expand All @@ -72,13 +60,21 @@ repositories {
mavenCentral()
}

nexusPublishing {
repositories {
sonatype { //only for users registered in Sonatype after 24 Feb 2021
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username = System.getenv("MAVEN_USER_NAME")
password = System.getenv("MAVEN_USER_PASSWORD")
jreleaser {
signing {
setActive("ALWAYS")
armored = true
}
deploy {
maven {
//Portal Publisher API
mavenCentral {
register("sonatype") {
setActive("ALWAYS")
url = "https://central.sonatype.com/api/v1/publisher"
stagingRepository("build/staging-deploy")
}
}
}
}
}
Expand Down Expand Up @@ -111,4 +107,9 @@ publishing {
}
}
}
repositories {
maven {
url = layout.buildDirectory.dir("staging-deploy").get().asFile.toURI()
}
}
}

0 comments on commit 0eebd22

Please sign in to comment.