-
Notifications
You must be signed in to change notification settings - Fork 31
chore: use new Maven Central publication mechanism #716
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
67e847a
Fix library version replacement on relocate
devnatan e8a1f54
chore: change publication urls
devnatan 6fd6b8b
fix: inverted urls
devnatan 600cfd7
chore: set version to snapshot
devnatan 506ce75
refactor: remove signing
devnatan bcc7149
fix: sonatype url and ossrh token
devnatan b02b0e5
fix: publication issues
devnatan 49d5146
fix: setup gradle workflow
devnatan 41cff05
chore: automatic release and disable daemon
devnatan 27a2a42
chore: remove snapshot from version
devnatan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,77 +1,13 @@ | ||
| import com.vanniktech.maven.publish.MavenPublishBaseExtension | ||
| import com.vanniktech.maven.publish.SonatypeHost | ||
| import org.gradle.api.Project | ||
| import org.gradle.api.publish.PublishingExtension | ||
| import org.gradle.api.publish.maven.MavenPublication | ||
| import org.gradle.kotlin.dsl.configure | ||
| import org.gradle.kotlin.dsl.create | ||
| import org.gradle.kotlin.dsl.the | ||
| import org.gradle.plugins.signing.SigningExtension | ||
|
|
||
| fun Project.configureMavenPublish() { | ||
| plugins.apply("maven-publish") | ||
| plugins.apply("signing") | ||
|
|
||
| val isReleaseVersion = !project.version.toString().endsWith("SNAPSHOT") | ||
|
|
||
| configure<PublishingExtension> { | ||
| publications { | ||
| create<MavenPublication>("javaOSSRH") { | ||
| groupId = rootProject.group.toString() | ||
| artifactId = project.name | ||
| version = rootProject.version.toString() | ||
| from(components.named("java").get()) | ||
|
|
||
| pom { | ||
| name.set("inventory-framework") | ||
| description.set("Minecraft Inventory API framework") | ||
| url.set("https://github.com/DevNatan/inventory-framework") | ||
| inceptionYear.set("2020") | ||
|
|
||
| licenses { | ||
| license { | ||
| name.set("MIT License") | ||
| url.set("https://github.com/DevNatan/inventory-framework/blob/main/LICENSE") | ||
| } | ||
| } | ||
| developers { | ||
| developer { | ||
| name.set("Natan Vieira do Nascimento") | ||
| email.set("natanvnascimento@gmail.com") | ||
| url.set("https://github.com/DevNatan") | ||
| } | ||
| } | ||
| scm { | ||
| connection.set("scm:git:git:github.com/DevNatan/inventoryframework.git") | ||
| developerConnection.set("scm:git:https://github.com/DevNatan/inventoryframework.git") | ||
| url.set("https://github.com/DevNatan/inventoryframework") | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| repositories { | ||
| maven { | ||
| name = "OSSRH" | ||
| url = uri( | ||
| if (isReleaseVersion) | ||
| "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
| else | ||
| "https://s01.oss.sonatype.org/content/repositories/snapshots/" | ||
| ) | ||
| credentials { | ||
| username = findProperty("ossrh.username") as String? ?: System.getenv("OSSRH_USERNAME") | ||
| password = findProperty("ossrh.password") as String? ?: System.getenv("OSSRH_PASSWORD") | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| configure<SigningExtension> { | ||
| isRequired = isReleaseVersion && gradle.taskGraph.hasTask("publish") | ||
| useInMemoryPgpKeys( | ||
| findProperty("signing.keyId") as String? ?: System.getenv("OSSRH_SIGNING_KEY"), | ||
| findProperty("signing.password") as String? ?: System.getenv("OSSRH_SIGNING_PASSWORD") | ||
| ) | ||
|
|
||
| sign(the<PublishingExtension>().publications.named("javaOSSRH").get()) | ||
| fun Project.configureInventoryFrameworkPublication() { | ||
| extensions.configure<MavenPublishBaseExtension> { | ||
| publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) | ||
| signAllPublications() | ||
| pomFromGradleProperties() | ||
| configureBasedOnAppliedPlugins() | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,23 @@ | ||
| org.gradle.parallel=true | ||
| org.gradle.configureondemand=true | ||
| org.gradle.configuration-cache=true | ||
| org.gradle.configuration-cache.parallel=true | ||
| kotlin.incremental=true | ||
| kotlin.jvm.target=21 | ||
| kotlin.compiler.execution.strategy=daemon | ||
| kotlin.compiler.execution.strategy=daemon | ||
| mavenCentralUsername=hF0LIjUb | ||
| mavenCentralPassword=YyOxPjtftSzmgN8sYNuS0beTp7Z916E6tB3Fhg8ftgIm | ||
|
|
||
| ### Publication ### | ||
| POM_NAME=inventory-framework | ||
| POM_DESCRIPTION=Minecraft Inventory API framework | ||
| POM_URL=https://github.com/DevNatan/inventory-framework | ||
| POM_INCEPTION_YEAR=2020 | ||
| POM_SCM_URL=https://github.com/DevNatan/inventoryframework | ||
| POM_SCM_CONNECTION=scm:git:git:github.com/DevNatan/inventoryframework.git | ||
| POM_SCM_DEV_CONNECTION=scm:git:https://github.com/DevNatan/inventoryframework.git | ||
| POM_LICENCE_NAME=MIT License | ||
| POM_LICENSE_URL=https://github.com/DevNatan/inventory-framework/blob/main/LICENSE | ||
| POM_DEVELOPER_ID=DevNatan | ||
| POM_DEVELOPER_NAME=Natan Vieira do Nascimento | ||
| POM_DEVELOPER_URL=natanvnascimento@gmail.com | ||
| POM_DEVELOPER_EMAIL=https://github.com/DevNatan | ||
| SONATYPE_HOST=CENTRAL_PORTAL | ||
| RELEASE_SIGNING_ENABLED=true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know.. Purposeful.