Skip to content

Commit 9b969cc

Browse files
authored
Merge pull request #832 from icerockdev/maven-portal-support
Maven portal support
2 parents 6be5f3e + 69db154 commit 9b969cc

7 files changed

Lines changed: 36 additions & 11 deletions

File tree

.github/workflows/publish.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@ jobs:
2828
distribution: zulu
2929
- name: Prebuild library
3030
run: ./gradlew publishToMavenLocal --rerun-tasks
31+
- name: Prebuild plugin
32+
run: ./gradlew -p resources-generator publishToMavenLocal --rerun-tasks
3133
- name: Publish library
32-
run: ./gradlew publish --no-parallel
33-
- name: Publish plugin
34+
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
35+
- name: Publish plugin to maven central
36+
run: ./gradlew -p resources-generator publishToSonatype closeAndReleaseSonatypeStagingRepository
37+
- name: Publish plugin to Gradle Plugin Portal
3438
run: ./gradlew -p resources-generator publishPlugins -Pgradle.publish.key=${{ secrets.GRADLE_PLUGIN_PORTAL_KEY }} -Pgradle.publish.secret=${{ secrets.GRADLE_PLUGIN_PORTAL_SECRET }}
3539
release:
3640
name: Create release

build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@ allprojects {
2424
version = moko.versions.resourcesVersion.get()
2525
}
2626
}
27+
28+
// required for nexus plugin
29+
group = "dev.icerock.moko"
30+
version = moko.versions.resourcesVersion.get()
31+
32+
apply(plugin = "nexus-publication-convention")

gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,4 @@ kotlinCompilerEmbeddable = { module = "org.jetbrains.kotlin:kotlin-compiler-embe
6262
detektGradlePlugin = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detektVersion" }
6363
mokoMultiplatformPlugin = { module = "dev.icerock:mobile-multiplatform", version.ref = "mokoMultiplatformPluginVersion" }
6464
composeJetBrainsPlugin = { module = "org.jetbrains.compose:compose-gradle-plugin", version.ref = "composeJetbrainsVersion" }
65+
nexusPublishing = { module = "io.github.gradle-nexus:publish-plugin", version = "2.0.0" }

resources-build-logic/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ dependencies {
1414
api(libs.kotlinGradlePlugin)
1515
api(libs.androidGradlePlugin)
1616
api(libs.detektGradlePlugin)
17+
api(libs.nexusPublishing)
1718
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
import java.net.URI
6+
7+
plugins {
8+
id("io.github.gradle-nexus.publish-plugin")
9+
}
10+
11+
nexusPublishing {
12+
repositories {
13+
// see https://central.sonatype.org/publish/publish-portal-ossrh-staging-api/#configuration
14+
sonatype {
15+
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
16+
snapshotRepositoryUrl.set(URI.create("https://central.sonatype.com/repository/maven-snapshots/"))
17+
username.set(System.getenv("OSSRH_USER"))
18+
password.set(System.getenv("OSSRH_KEY"))
19+
}
20+
}
21+
}

resources-build-logic/src/main/kotlin/publication-convention.gradle.kts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,6 @@ plugins {
99
}
1010

1111
publishing {
12-
repositories.maven("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
13-
name = "OSSRH"
14-
15-
credentials {
16-
username = System.getenv("OSSRH_USER")
17-
password = System.getenv("OSSRH_KEY")
18-
}
19-
}
20-
2112
publications.withType<MavenPublication> {
2213
// Provide artifacts information requited by Maven Central
2314
pom {

resources-generator/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ plugins {
1212
id("com.gradle.plugin-publish") version ("1.2.0")
1313
id("java-gradle-plugin")
1414
kotlin("plugin.serialization") version ("1.9.25")
15+
id("nexus-publication-convention")
1516
}
1617

1718
group = "dev.icerock.moko"

0 commit comments

Comments
 (0)