Skip to content

Commit 383a37c

Browse files
committed
release: v4.1.2
1 parent ff2520b commit 383a37c

File tree

5 files changed

+116
-57
lines changed

5 files changed

+116
-57
lines changed

.github/workflows/publish-release.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ env:
1313
JAVA_DISTRIBUTION: zulu
1414
GRADLE_VERSION: 8.10.2
1515
IS_CI: true
16-
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
17-
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
18-
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
19-
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
20-
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
16+
SIGNING_KEY_ID: ${{ secrets.GPG_KEY_ID }}
17+
GPG_KEY_CONTENTS: ${{ secrets.GPG_SECRET_KEY }}
18+
SIGNING_PASSWORD: ${{ secrets.GPG_PASSWORD }}
19+
MAVEN_CENTRAL_USERNAME: ${{ secrets.CENTRAL_PORTAL_USERNAME }}
20+
MAVEN_CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PORTAL_PASSWORD }}
2121
GRADLE_OPTS: "-Xmx8g -Xms2g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8"
2222

2323
jobs:
@@ -47,9 +47,6 @@ jobs:
4747
--warning-mode all
4848
-Pkotlin.native.enableKlibsCrossCompilation=false
4949
50-
# - name: Run all tests
51-
# run: gradle assemble allTests --stacktrace --warning-mode all -Pkotlin.native.enableKlibsCrossCompilation=false
52-
5350
publish-releases:
5451
name: Publish releases
5552
needs: run-test
@@ -68,8 +65,8 @@ jobs:
6865
with:
6966
gradle-version: ${{ env.GRADLE_VERSION }}
7067
arguments: |
71-
publishToSonatype
72-
closeAndReleaseStagingRepositories
68+
publishAndReleaseToMavenCentral
69+
--no-configuration-cache
7370
--info
7471
--warning-mode all
7572
-x test
@@ -79,6 +76,11 @@ jobs:
7976
env:
8077
SIMBOT_IS_SNAPSHOT: false
8178
SIMBOT_RELEASES_ONLY: true
79+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ env.MAVEN_CENTRAL_USERNAME }}
80+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ env.MAVEN_CENTRAL_PASSWORD }}
81+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ env.SIGNING_KEY_ID }}
82+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ env.SIGNING_PASSWORD }}
83+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ env.GPG_KEY_CONTENTS }}
8284

8385
create-release:
8486
name: Create release

.github/workflows/publish-snapshot.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ env:
2424
JAVA_DISTRIBUTION: zulu
2525
GRADLE_VERSION: 8.10.2
2626
IS_CI: true
27-
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
28-
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
29-
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
30-
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
31-
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
27+
SIGNING_KEY_ID: ${{ secrets.GPG_KEY_ID }}
28+
GPG_KEY_CONTENTS: ${{ secrets.GPG_SECRET_KEY }}
29+
SIGNING_PASSWORD: ${{ secrets.GPG_PASSWORD }}
30+
MAVEN_CENTRAL_USERNAME: ${{ secrets.CENTRAL_PORTAL_USERNAME }}
31+
MAVEN_CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PORTAL_PASSWORD }}
3232
SIMBOT_IS_SNAPSHOT: true
3333
SIMBOT_SNAPSHOT_ONLY: true
3434
GRADLE_OPTS: "-Dfile.encoding=UTF-8"
@@ -60,9 +60,6 @@ jobs:
6060
--warning-mode all
6161
-Pkotlin.native.enableKlibsCrossCompilation=false
6262
63-
# - name: Gradle run all tests
64-
# run: gradle assemble allTests --stacktrace --warning-mode all -Pkotlin.native.enableKlibsCrossCompilation=false
65-
6663
publish-snapshots:
6764
name: Publish snapshots
6865
needs: run-test
@@ -81,13 +78,18 @@ jobs:
8178
with:
8279
gradle-version: ${{ env.GRADLE_VERSION }}
8380
arguments: |
84-
publishToSonatype
85-
closeAndReleaseStagingRepositories
81+
publishAndReleaseToMavenCentral
82+
--no-configuration-cache
8683
--info
8784
--warning-mode all
8885
-Porg.gradle.jvmargs="-Xmx8g -Xms2g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8"
8986
env:
9087
SIMBOT_IS_SNAPSHOT: true
88+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ env.MAVEN_CENTRAL_USERNAME }}
89+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ env.MAVEN_CENTRAL_PASSWORD }}
90+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ env.SIGNING_KEY_ID }}
91+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ env.SIGNING_PASSWORD }}
92+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ env.GPG_KEY_CONTENTS }}
9193

9294
deploy-doc:
9395
name: Deploy snapshot doc

buildSrc/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ dependencies {
3838
// see https://github.com/gradle-nexus/publish-plugin
3939
implementation("io.github.gradle-nexus:publish-plugin:2.0.0")
4040

41+
// see https://www.jetbrains.com/help/kotlin-multiplatform-dev/multiplatform-publish-libraries.html#configure-the-project
42+
// see https://github.com/vanniktech/gradle-maven-publish-plugin
43+
// see https://plugins.gradle.org/plugin/com.vanniktech.maven.publish
44+
implementation("com.vanniktech.maven.publish:com.vanniktech.maven.publish.gradle.plugin:0.32.0")
45+
4146
// simbot suspend transform gradle common
4247
implementation(libs.simbot.gradle)
4348

buildSrc/src/main/kotlin/P.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import love.forte.gradle.common.core.project.ProjectDetail
2424
import love.forte.gradle.common.core.property.systemProp
2525

26+
// Publish your library to Maven Central – tutorial
27+
// https://www.jetbrains.com/help/kotlin-multiplatform-dev/multiplatform-publish-libraries.html#prepare-accounts-and-credentials
2628

2729
object P : ProjectDetail() {
2830
const val GROUP = "love.forte.simbot.component"
@@ -32,7 +34,7 @@ object P : ProjectDetail() {
3234
override val homepage: String
3335
get() = HOMEPAGE
3436

35-
const val VERSION = "4.1.1"
37+
const val VERSION = "4.1.2"
3638
const val NEXT_VERSION = "4.1.2"
3739

3840
override val snapshotVersion = "$NEXT_VERSION-SNAPSHOT"

buildSrc/src/main/kotlin/kook-multiplatform-maven-publish.gradle.kts

Lines changed: 84 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@
1818
* If not, see <https://www.gnu.org/licenses/>.
1919
*/
2020

21-
import love.forte.gradle.common.core.Gpg
21+
import com.vanniktech.maven.publish.SonatypeHost
2222
import love.forte.gradle.common.core.project.setup
23+
import love.forte.gradle.common.core.property.ofIf
2324
import love.forte.gradle.common.core.property.systemProp
24-
import love.forte.gradle.common.publication.configure.configPublishMaven
25-
import love.forte.gradle.common.publication.configure.publishingExtension
26-
import love.forte.gradle.common.publication.configure.setupPom
25+
import org.gradle.internal.impldep.org.bouncycastle.asn1.x509.X509ObjectIdentifiers.organization
2726

2827
plugins {
2928
kotlin("multiplatform")
3029
signing
31-
`maven-publish`
30+
// https://www.jetbrains.com/help/kotlin-multiplatform-dev/multiplatform-publish-libraries.html#configure-the-project
31+
id("com.vanniktech.maven.publish")
3232
id("org.jetbrains.dokka")
3333
}
3434

@@ -38,48 +38,96 @@ setup(P)
3838
val p = project
3939
val isSnapshot = project.version.toString().contains("SNAPSHOT", true)
4040

41-
val jarJavadoc by tasks.registering(Jar::class) {
42-
group = "documentation"
43-
archiveClassifier.set("javadoc")
44-
if (!(isSnapshot || isSnapshot() || isSimbotLocal())) {
45-
dependsOn(tasks.dokkaGeneratePublicationHtml)
46-
from(tasks.dokkaGeneratePublicationHtml.flatMap { it.outputDirectory })
41+
mavenPublishing {
42+
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
43+
if (!isSimbotLocal()) {
44+
signAllPublications()
4745
}
48-
}
46+
coordinates(groupId = p.group.toString(), artifactId = p.name, version = p.version.toString())
4947

50-
publishing {
51-
repositories {
52-
mavenLocal()
53-
if (isSnapshot) {
54-
configPublishMaven(SnapshotRepository)
55-
} else {
56-
configPublishMaven(ReleaseRepository)
48+
pom {
49+
name = p.name
50+
description = p.description
51+
url = P.HOMEPAGE
52+
licenses {
53+
P.licenses.forEach { license ->
54+
license {
55+
name ofIf license.name
56+
url ofIf license.url
57+
distribution ofIf license.distribution
58+
comments ofIf license.comments
59+
}
60+
}
5761
}
58-
}
5962

60-
publications {
61-
withType<MavenPublication> {
62-
artifacts {
63-
artifact(jarJavadoc)
64-
}
63+
val scm = P.scm
64+
scm {
65+
url ofIf scm.url
66+
connection ofIf scm.connection
67+
developerConnection ofIf scm.developerConnection
68+
tag ofIf scm.tag
69+
}
6570

66-
setupPom(project.name, P)
71+
developers {
72+
P.developers.forEach { developer ->
73+
developer {
74+
id ofIf developer.id
75+
name ofIf developer.name
76+
email ofIf developer.email
77+
url ofIf developer.url
78+
organization ofIf developer.organization
79+
organizationUrl ofIf developer.organizationUrl
80+
timezone ofIf developer.timezone
81+
roles.addAll(developer.roles)
82+
properties.putAll(developer.properties)
83+
}
84+
}
6785
}
6886
}
6987
}
7088

71-
signing {
72-
val gpg = Gpg.ofSystemPropOrNull() ?: return@signing
73-
val (keyId, secretKey, password) = gpg
74-
useInMemoryPgpKeys(keyId, secretKey, password)
75-
sign(publishingExtension.publications)
76-
}
89+
//val jarJavadoc by tasks.registering(Jar::class) {
90+
// group = "documentation"
91+
// archiveClassifier.set("javadoc")
92+
// if (!(isSnapshot || isSnapshot() || isSimbotLocal())) {
93+
// dependsOn(tasks.dokkaGeneratePublicationHtml)
94+
// from(tasks.dokkaGeneratePublicationHtml.flatMap { it.outputDirectory })
95+
// }
96+
//}
97+
98+
//publishing {
99+
// repositories {
100+
// mavenLocal()
101+
// if (isSnapshot) {
102+
// configPublishMaven(SnapshotRepository)
103+
// } else {
104+
// configPublishMaven(ReleaseRepository)
105+
// }
106+
// }
107+
//
108+
// publications {
109+
// withType<MavenPublication> {
110+
// artifacts {
111+
// artifact(jarJavadoc)
112+
// }
113+
//
114+
// setupPom(project.name, P)
115+
// }
116+
// }
117+
//}
118+
//
119+
//signing {
120+
// val gpg = Gpg.ofSystemPropOrNull() ?: return@signing
121+
// val (keyId, secretKey, password) = gpg
122+
// useInMemoryPgpKeys(keyId, secretKey, password)
123+
// sign(publishingExtension.publications)
124+
//}
77125

78126
// TODO see https://github.com/gradle-nexus/publish-plugin/issues/208#issuecomment-1465029831
79-
val signingTasks: TaskCollection<Sign> = tasks.withType<Sign>()
80-
tasks.withType<PublishToMavenRepository>().configureEach {
81-
mustRunAfter(signingTasks)
82-
}
127+
//val signingTasks: TaskCollection<Sign> = tasks.withType<Sign>()
128+
//tasks.withType<PublishToMavenRepository>().configureEach {
129+
// mustRunAfter(signingTasks)
130+
//}
83131

84132
show()
85133

0 commit comments

Comments
 (0)