Skip to content

Commit 74f2dbf

Browse files
authored
Update publishing configuration for Maven Central (#746)
* Update publishing configuration for Maven Central * Moved pom details into individual build files * Added manual trigger for publish
1 parent 31a8e67 commit 74f2dbf

File tree

31 files changed

+694
-165
lines changed

31 files changed

+694
-165
lines changed

.github/workflows/publish.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ name: Publish
66
on:
77
release:
88
types: [ prereleased, released ]
9+
workflow_dispatch:
910

1011
env:
11-
sonatypeUsername: ${{ secrets.SONATYPEUSERNAME }}
12-
sonatypePassword: ${{ secrets.SONATYPEPASSWORD }}
13-
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }}
14-
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PASSPHRASE }}
12+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPEUSERNAME }}
13+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPEPASSWORD }}
14+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_PRIVATE_KEY }}
15+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.PASSPHRASE }}
1516

1617
jobs:
1718
build:

build.gradle.kts

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ plugins {
1919
alias(libs.plugins.kotlinter) apply false
2020
alias(libs.plugins.kotlinx.binarycompatibilityvalidator)
2121
alias(libs.plugins.dokka)
22+
alias(libs.plugins.publish) apply false
2223
id("base")
2324
id("testOptionsConvention")
2425
}
@@ -187,68 +188,6 @@ subprojects {
187188

188189
apply(plugin = "maven-publish")
189190
apply(plugin = "signing")
190-
191-
val javadocJar: TaskProvider<Jar> by tasks.registering(Jar::class) {
192-
archiveClassifier.set("javadoc")
193-
}
194-
195-
configure<PublishingExtension> {
196-
197-
repositories {
198-
maven {
199-
url = uri("https://central.sonatype.com/repository/maven-snapshots")
200-
credentials {
201-
username = project.findProperty("sonatypeUsername") as String? ?: System.getenv("sonatypeUsername")
202-
password = project.findProperty("sonatypePassword") as String? ?: System.getenv("sonatypePassword")
203-
}
204-
}
205-
}
206-
207-
publications.all {
208-
this as MavenPublication
209-
artifact(javadocJar)
210-
211-
pom {
212-
name.set("firebase-kotlin-sdk")
213-
description.set("The Firebase Kotlin SDK is a Kotlin-first SDK for Firebase. It's API is similar to the Firebase Android SDK Kotlin Extensions but also supports multiplatform projects, enabling you to use Firebase directly from your common source targeting iOS, Android or JS.")
214-
url.set("https://github.com/GitLiveApp/firebase-kotlin-sdk")
215-
inceptionYear.set("2019")
216-
217-
scm {
218-
url.set("https://github.com/GitLiveApp/firebase-kotlin-sdk")
219-
connection.set("scm:git:https://github.com/GitLiveApp/firebase-kotlin-sdk.git")
220-
developerConnection.set("scm:git:https://github.com/GitLiveApp/firebase-kotlin-sdk.git")
221-
tag.set("HEAD")
222-
}
223-
224-
issueManagement {
225-
system.set("GitHub Issues")
226-
url.set("https://github.com/GitLiveApp/firebase-kotlin-sdk/issues")
227-
}
228-
229-
developers {
230-
developer {
231-
name.set("Nicholas Bransby-Williams")
232-
email.set("[email protected]")
233-
}
234-
}
235-
236-
licenses {
237-
license {
238-
name.set("The Apache Software License, Version 2.0")
239-
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
240-
distribution.set("repo")
241-
comments.set("A business-friendly OSS license")
242-
}
243-
}
244-
}
245-
}
246-
247-
}
248-
249-
tasks.withType(AbstractPublishToMaven::class.java).configureEach {
250-
dependsOn(tasks.withType(Sign::class.java))
251-
}
252191
}
253192

254193
tasks.withType<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask> {

firebase-analytics/build.gradle.kts

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import org.gradle.kotlin.dsl.distribution
12
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
23
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
34
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptions
45
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree
6+
import kotlin.text.set
57

68
/*
79
* Copyright (c) 2023 GitLive Ltd. Use of this source code is governed by the Apache 2.0 license.
@@ -14,6 +16,7 @@ plugins {
1416
kotlin("native.cocoapods")
1517
kotlin("multiplatform")
1618
id("testOptionsConvention")
19+
alias(libs.plugins.publish)
1720
}
1821

1922
android {
@@ -160,9 +163,48 @@ if (project.property("firebase-analytics.skipJsTests") == "true") {
160163
}
161164
}
162165

163-
signing {
164-
val signingKey: String? by project
165-
val signingPassword: String? by project
166-
useInMemoryPgpKeys(signingKey, signingPassword)
167-
sign(publishing.publications)
166+
mavenPublishing {
167+
publishToMavenCentral(automaticRelease = true)
168+
signAllPublications()
169+
170+
coordinates(
171+
groupId = "dev.gitlive",
172+
artifactId = "firebase-analytics",
173+
version = project.property("firebase-analytics.version") as String
174+
)
175+
176+
pom {
177+
name.set("firebase-kotlin-sdk")
178+
description.set("The Firebase Kotlin SDK is a Kotlin-first SDK for Firebase. It's API is similar to the Firebase Android SDK Kotlin Extensions but also supports multiplatform projects, enabling you to use Firebase directly from your common source targeting iOS, Android or JS.")
179+
url.set("https://github.com/GitLiveApp/firebase-kotlin-sdk")
180+
inceptionYear.set("2019")
181+
182+
scm {
183+
url.set("https://github.com/GitLiveApp/firebase-kotlin-sdk")
184+
connection.set("scm:git:https://github.com/GitLiveApp/firebase-kotlin-sdk.git")
185+
developerConnection.set("scm:git:https://github.com/GitLiveApp/firebase-kotlin-sdk.git")
186+
tag.set("HEAD")
187+
}
188+
189+
issueManagement {
190+
system.set("GitHub Issues")
191+
url.set("https://github.com/GitLiveApp/firebase-kotlin-sdk/issues")
192+
}
193+
194+
developers {
195+
developer {
196+
name.set("Nicholas Bransby-Williams")
197+
email.set("[email protected]")
198+
}
199+
}
200+
201+
licenses {
202+
license {
203+
name.set("The Apache Software License, Version 2.0")
204+
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
205+
distribution.set("repo")
206+
comments.set("A business-friendly OSS license")
207+
}
208+
}
209+
}
168210
}

firebase-analytics/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitlive/firebase-analytics",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-analytics.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
},
2424
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk",
2525
"dependencies": {
26-
"@gitlive/firebase-app": "2.1.0",
26+
"@gitlive/firebase-app": "2.2.0",
2727
"firebase": "9.19.1",
2828
"kotlin": "1.6.10",
2929
"kotlinx-coroutines-core": "1.6.1-native-mt"

firebase-app/build.gradle.kts

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import org.gradle.kotlin.dsl.distribution
12
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
23
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
34
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptions
45
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree
6+
import kotlin.text.set
57

68
/*
79
* Copyright (c) 2020 GitLive Ltd. Use of this source code is governed by the Apache 2.0 license.
@@ -14,6 +16,7 @@ plugins {
1416
kotlin("native.cocoapods")
1517
kotlin("multiplatform")
1618
id("testOptionsConvention")
19+
alias(libs.plugins.publish)
1720
}
1821

1922
android {
@@ -165,9 +168,48 @@ if (project.property("firebase-app.skipJsTests") == "true") {
165168
}
166169
}
167170

168-
signing {
169-
val signingKey: String? by project
170-
val signingPassword: String? by project
171-
useInMemoryPgpKeys(signingKey, signingPassword)
172-
sign(publishing.publications)
171+
mavenPublishing {
172+
publishToMavenCentral(automaticRelease = true)
173+
signAllPublications()
174+
175+
coordinates(
176+
groupId = "dev.gitlive",
177+
artifactId = "firebase-app",
178+
version = project.property("firebase-app.version") as String
179+
)
180+
181+
pom {
182+
name.set("firebase-kotlin-sdk")
183+
description.set("The Firebase Kotlin SDK is a Kotlin-first SDK for Firebase. It's API is similar to the Firebase Android SDK Kotlin Extensions but also supports multiplatform projects, enabling you to use Firebase directly from your common source targeting iOS, Android or JS.")
184+
url.set("https://github.com/GitLiveApp/firebase-kotlin-sdk")
185+
inceptionYear.set("2019")
186+
187+
scm {
188+
url.set("https://github.com/GitLiveApp/firebase-kotlin-sdk")
189+
connection.set("scm:git:https://github.com/GitLiveApp/firebase-kotlin-sdk.git")
190+
developerConnection.set("scm:git:https://github.com/GitLiveApp/firebase-kotlin-sdk.git")
191+
tag.set("HEAD")
192+
}
193+
194+
issueManagement {
195+
system.set("GitHub Issues")
196+
url.set("https://github.com/GitLiveApp/firebase-kotlin-sdk/issues")
197+
}
198+
199+
developers {
200+
developer {
201+
name.set("Nicholas Bransby-Williams")
202+
email.set("[email protected]")
203+
}
204+
}
205+
206+
licenses {
207+
license {
208+
name.set("The Apache Software License, Version 2.0")
209+
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
210+
distribution.set("repo")
211+
comments.set("A business-friendly OSS license")
212+
}
213+
}
214+
}
173215
}

firebase-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitlive/firebase-app",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-app.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
},
2424
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk",
2525
"dependencies": {
26-
"@gitlive/firebase-common": "2.1.0",
26+
"@gitlive/firebase-common": "2.2.0",
2727
"firebase": "9.19.1",
2828
"kotlin": "1.8.20",
2929
"kotlinx-coroutines-core": "1.6.4"

firebase-auth/build.gradle.kts

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import org.gradle.kotlin.dsl.distribution
12
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
23
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
34
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptions
45
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree
56
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithSimulatorTests
67
import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeSimulatorTest
8+
import kotlin.text.set
79

810
/*
911
* Copyright (c) 2020 GitLive Ltd. Use of this source code is governed by the Apache 2.0 license.
@@ -16,6 +18,7 @@ plugins {
1618
kotlin("multiplatform")
1719
kotlin("native.cocoapods")
1820
id("testOptionsConvention")
21+
alias(libs.plugins.publish)
1922
}
2023

2124
android {
@@ -186,9 +189,48 @@ fun KotlinNativeTargetWithSimulatorTests.enableKeychainForTests() {
186189
}
187190
}
188191

189-
signing {
190-
val signingKey: String? by project
191-
val signingPassword: String? by project
192-
useInMemoryPgpKeys(signingKey, signingPassword)
193-
sign(publishing.publications)
192+
mavenPublishing {
193+
publishToMavenCentral(automaticRelease = true)
194+
signAllPublications()
195+
196+
coordinates(
197+
groupId = "dev.gitlive",
198+
artifactId = "firebase-auth",
199+
version = project.property("firebase-auth.version") as String
200+
)
201+
202+
pom {
203+
name.set("firebase-kotlin-sdk")
204+
description.set("The Firebase Kotlin SDK is a Kotlin-first SDK for Firebase. It's API is similar to the Firebase Android SDK Kotlin Extensions but also supports multiplatform projects, enabling you to use Firebase directly from your common source targeting iOS, Android or JS.")
205+
url.set("https://github.com/GitLiveApp/firebase-kotlin-sdk")
206+
inceptionYear.set("2019")
207+
208+
scm {
209+
url.set("https://github.com/GitLiveApp/firebase-kotlin-sdk")
210+
connection.set("scm:git:https://github.com/GitLiveApp/firebase-kotlin-sdk.git")
211+
developerConnection.set("scm:git:https://github.com/GitLiveApp/firebase-kotlin-sdk.git")
212+
tag.set("HEAD")
213+
}
214+
215+
issueManagement {
216+
system.set("GitHub Issues")
217+
url.set("https://github.com/GitLiveApp/firebase-kotlin-sdk/issues")
218+
}
219+
220+
developers {
221+
developer {
222+
name.set("Nicholas Bransby-Williams")
223+
email.set("[email protected]")
224+
}
225+
}
226+
227+
licenses {
228+
license {
229+
name.set("The Apache Software License, Version 2.0")
230+
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
231+
distribution.set("repo")
232+
comments.set("A business-friendly OSS license")
233+
}
234+
}
235+
}
194236
}

firebase-auth/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitlive/firebase-auth",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-auth.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
},
2424
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk",
2525
"dependencies": {
26-
"@gitlive/firebase-app": "2.1.0",
26+
"@gitlive/firebase-app": "2.2.0",
2727
"firebase": "9.19.1",
2828
"kotlin": "1.8.20",
2929
"kotlinx-coroutines-core": "1.6.4"

0 commit comments

Comments
 (0)