From 6648638cb1f9df3ffbc97fab3ab23f51e9ba06d3 Mon Sep 17 00:00:00 2001 From: Mohsen Mirhoseini Date: Fri, 3 Feb 2023 14:55:27 +0100 Subject: [PATCH] Add Maven Central publication (#1) --- constants.gradle | 2 +- publish.gradle | 46 ++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/constants.gradle b/constants.gradle index 7fd89a86d63..16f2504c1cc 100644 --- a/constants.gradle +++ b/constants.gradle @@ -13,7 +13,7 @@ // limitations under the License. project.ext { // ExoPlayer version and version code. - releaseVersion = '2.16.1' + releaseVersion = '2.16.1.6' releaseVersionCode = 2016001 minSdkVersion = 16 appTargetSdkVersion = 29 diff --git a/publish.gradle b/publish.gradle index 389c03ee15f..e1c3b6f6e41 100644 --- a/publish.gradle +++ b/publish.gradle @@ -13,23 +13,44 @@ // limitations under the License. apply plugin: 'maven-publish' +apply plugin: 'signing' + afterEvaluate { + publishing { repositories { maven { + name = 'mavenRepo' url = findProperty('mavenRepo') ?: "${buildDir}/repo" } + maven { + def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" + def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" + + url = releaseVersion.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl + + credentials { + username = System.getenv("OSSRH_USERNAME") + password = System.getenv("OSSRH_PASSWORD") + } + } } + publications { release(MavenPublication) { - from components.release - artifact androidSourcesJar groupId = 'com.firework.android.exoplayer' artifactId = releaseArtifactId version releaseVersion + + from components.release + + artifact androidSourcesJar + pom { name = releaseArtifactId description = releaseDescription + url = 'https://firework.com' + licenses { license { name = 'The Apache Software License, Version 2.0' @@ -39,19 +60,32 @@ afterEvaluate { } developers { developer { - name = 'The Android Open Source Project' + id = 'Firework' + name = 'Firework Android Team' + email = 'team-android@fireworkhq.com' } } + scm { - connection = 'scm:git:https://github.com/google/ExoPlayer.git' - url = 'https://github.com/google/ExoPlayer' + connection = 'scm:git:git@github.com:loopsocial/ExoPlayer.git' + url = 'https://github.com/loopsocial/ExoPlayer' } } } } } + + signing { + def signingKeyId = System.getenv("GPG_SIGNING_KEY_ID") + def signingSecretKey = System.getenv("GPG_SIGNING_SECRET_KEY") + def signingPassword = System.getenv("GPG_SIGNING_PASSWORD") + useInMemoryPgpKeys(signingKeyId, signingSecretKey, signingPassword) + + sign publishing.publications.release + } } -tasks.withType(PublishToMavenRepository) { it.dependsOn lint, test } + +// tasks.withType(PublishToMavenRepository) { it.dependsOn lint, test } task androidSourcesJar(type: Jar) { archiveClassifier.set('sources')