Skip to content

Commit

Permalink
Add Maven Central publication (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsenoid authored Feb 3, 2023
1 parent 5da0839 commit 6648638
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 7 deletions.
2 changes: 1 addition & 1 deletion constants.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
46 changes: 40 additions & 6 deletions publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -39,19 +60,32 @@ afterEvaluate {
}
developers {
developer {
name = 'The Android Open Source Project'
id = 'Firework'
name = 'Firework Android Team'
email = '[email protected]'
}
}

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')
Expand Down

0 comments on commit 6648638

Please sign in to comment.