diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml index 7155fd0b..b7aa1043 100644 --- a/.github/workflows/publishing.yml +++ b/.github/workflows/publishing.yml @@ -16,11 +16,20 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v6 + - name: Setup Gradle Properties + run: echo "org.gradle.jvmargs=-Xmx2g" >> gradle.properties + - name: Execute Gradle build - run: ./gradlew build + run: ./gradlew build --no-daemon --stacktrace - name: Publish to Ossrh - run: ./gradlew publishAllPublicationsToOssrhRepository -PossrhUsername=${{ secrets.OSSRH_USERNAME }} -PossrhPassword=${{ secrets.OSSRH_PASSWORD }} + run: ./gradlew publishToMavenCentral + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY_CONTENTS }} - name: Publish to Modrinth - run: ./gradlew :silk-all:modrinth -Pmodrinth.token=${{ secrets.MODRINTH_TOKEN }} + run: ./gradlew :silk-all:modrinth -Pmodrinth.token=${{ secrets.MODRINTH_TOKEN }} \ No newline at end of file diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index fd28409c..925bd01a 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -27,6 +27,8 @@ dependencies { implementation(pluginDep("io.papermc.paperweight.userdev", "1.7.2")) implementation(pluginDep("xyz.jpenilla.run-paper", "2.3.0")) + implementation(pluginDep("com.vanniktech.maven.publish", "0.34.0")) + val compileDokkaVersion = "1.9.20" val dokkaVersion = "1.9.20" diff --git a/buildSrc/src/main/kotlin/project-publish-script.gradle.kts b/buildSrc/src/main/kotlin/project-publish-script.gradle.kts index 2534af83..ee325aa4 100644 --- a/buildSrc/src/main/kotlin/project-publish-script.gradle.kts +++ b/buildSrc/src/main/kotlin/project-publish-script.gradle.kts @@ -1,67 +1,44 @@ import BuildConstants.authors import BuildConstants.githubRepo -import BuildConstants.isSnapshot +import com.vanniktech.maven.publish.KotlinJvm plugins { - kotlin("jvm") - - `maven-publish` - signing + id("com.vanniktech.maven.publish") } -publishing { - repositories { - maven { - name = "ossrh" - credentials(PasswordCredentials::class) - setUrl( - if (!isSnapshot) - "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2" - else - "https://s01.oss.sonatype.org/content/repositories/snapshots" - ) - } - } +mavenPublishing { + configure(KotlinJvm()) - publications { - register(project.name) { - // publish main jars - from(components["java"]) + publishToMavenCentral(false) - this.groupId = project.group.toString() - this.artifactId = project.name - this.version = rootProject.version.toString() + signAllPublications() - pom { - name.set(project.name) - description.set(project.description) + pom { + name = project.name + description = project.description - developers { - authors.forEach { - developer { - name.set(it) - } - } + developers { + authors.forEach { + developer { + name = it } + } + } - licenses { - license { - name.set("GNU General Public License 3") - url.set("https://www.gnu.org/licenses/gpl-3.0.txt") - } - } + licenses { + license { + name = "GNU General Public License 3" + url = "https://www.gnu.org/licenses/gpl-3.0.txt" + distribution = "https://www.gnu.org/licenses/gpl-3.0.txt" + } + } - url.set("https://github.com/${githubRepo}") + url = "https://github.com/$githubRepo" - scm { - connection.set("scm:git:git://github.com/${githubRepo}.git") - url.set("https://github.com/${githubRepo}/tree/main") - } - } + scm { + connection = "scm:git:git://github.com/$githubRepo.git" + url = "https://github.com/$githubRepo/tree/main" + developerConnection = "cm:git:ssh://git@github.com/$githubRepo.git" } } -} - -signing { - sign(publishing.publications) -} +} \ No newline at end of file