Skip to content

Commit 324ff7c

Browse files
committed
build: Update publishing
1 parent 9af4b93 commit 324ff7c

5 files changed

Lines changed: 32 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ jobs:
3737
fi
3838
- name: Publish Snapshot
3939
if: "${{ env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/master' }}"
40-
run: ./gradlew publish
40+
run: ./gradlew publishAllPublicationsToSonatypeSnapshots
4141
env:
4242
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SONATYPE_USERNAME }}"
4343
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SONATYPE_PASSWORD }}"
4444
- name: Publish Release
4545
if: "${{ env.STATUS == 'release' && github.event_name == 'release' }}"
46-
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
46+
run: ./gradlew publishReleaseCentralPortalBundle
4747
env:
4848
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SONATYPE_USERNAME }}"
4949
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SONATYPE_PASSWORD }}"

build.gradle.kts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
2-
alias(libs.plugins.cloud.buildLogic.rootProject.publishing)
2+
// alias(libs.plugins.cloud.buildLogic.rootProject.publishing)
3+
alias(libs.plugins.centralPublishing)
34
alias(libs.plugins.cloud.buildLogic.rootProject.spotless)
45
}
56

@@ -16,3 +17,10 @@ tasks {
1617
dependsOn(gradle.includedBuild("build-logic").task(":spotlessApply"))
1718
}
1819
}
20+
21+
tasks.register("publish") // TODO - below makes publish dependsOn it
22+
centralPortalPublishing.bundle("release") {
23+
username = providers.gradleProperty("sonatypeUsername")
24+
password = providers.gradleProperty("sonatypePassword")
25+
publishingType = "AUTOMATIC"
26+
}

gradle/build-logic/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ dependencies {
1515
// loom needs this version of asm, for some reason we have an older one on the classpath without this
1616
implementation("org.ow2.asm:asm:9.8")
1717
implementation(libs.cloud.build.logic)
18+
implementation(libs.centralPublishing)
1819

1920
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
2021
}

gradle/build-logic/src/main/kotlin/conventions.publishing.gradle.kts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import dev.lukebemish.centralportalpublishing.CentralPortalRepositoryHandlerExtension
12
import org.incendo.cloudbuildlogic.city
23
import org.incendo.cloudbuildlogic.jmp
34

45
plugins {
56
id("org.incendo.cloud-build-logic.publishing")
7+
id("dev.lukebemish.central-portal-publishing")
68
}
79

810
indra {
@@ -25,3 +27,18 @@ javadocLinks {
2527
override(libs.fabricLoader, "https://maven.fabricmc.net/docs/fabric-loader-{version}")
2628
excludes.add("net.fabricmc.fabric-api:")
2729
}
30+
31+
publishing {
32+
repositories {
33+
val portal = (this as ExtensionAware).extensions.getByType(CentralPortalRepositoryHandlerExtension::class)
34+
portal.portalBundle(":", "release")
35+
36+
maven("https://central.sonatype.com/repository/maven-snapshots/") {
37+
name = "SonatypeSnapshots"
38+
credentials(PasswordCredentials::class) {
39+
username = providers.gradleProperty("sonatypeUsername").getOrElse("username")
40+
password = providers.gradleProperty("sonatypePassword").getOrElse("password")
41+
}
42+
}
43+
}
44+
}

gradle/libs.versions.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[versions]
22
cloud-build-logic = "0.0.16"
3+
centralPublishing = "0.1.6"
34
checkstyle = "10.12.5"
45
stylecheck = "0.2.1"
56
ktlint = "0.50.0"
@@ -21,6 +22,7 @@ adventureMod = "6.4.0"
2122

2223
[libraries]
2324
cloud-build-logic = { module = "org.incendo:cloud-build-logic", version.ref = "cloud-build-logic" }
25+
centralPublishing = { module = "dev.lukebemish:central-portal-publishing", version.ref = "centralPublishing" }
2426
stylecheck = { module = "ca.stellardrift:stylecheck", version.ref = "stylecheck" }
2527
errorproneCore = { group = "com.google.errorprone", name = "error_prone_core", version.ref = "errorprone" }
2628

@@ -54,6 +56,7 @@ zNeoForge = { module = "net.neoforged:neoforge", version.ref = "neoforge" }
5456
cloud-buildLogic-spotless = { id = "org.incendo.cloud-build-logic.spotless", version.ref = "cloud-build-logic" }
5557
cloud-buildLogic-rootProject-publishing = { id = "org.incendo.cloud-build-logic.publishing.root-project", version.ref = "cloud-build-logic" }
5658
cloud-buildLogic-rootProject-spotless = { id = "org.incendo.cloud-build-logic.spotless.root-project", version.ref = "cloud-build-logic" }
59+
centralPublishing = { id = "dev.lukebemish.central-portal-publishing", version.ref = "centralPublishing" }
5760

5861
[bundles]
5962
immutables = ["immutables", "immutablesAnnotate"]

0 commit comments

Comments
 (0)