From 859cb4004c1abca68f989a5cd20e5298043603ff Mon Sep 17 00:00:00 2001 From: Syed Ibrahim Date: Mon, 2 Jun 2025 15:22:45 +0530 Subject: [PATCH 1/2] Add support for Maven publish --- .github/workflows/publish.yml | 25 +++++++++++++++ tpstreams-android-player/build.gradle.kts | 37 ++++++++++++++++++++++- 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..ed9d2c1 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,25 @@ +name: Publish +on: + workflow_dispatch: +jobs: + publish: + name: Release build and publish + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 21 + - name: Make gradlew executable + run: chmod +x ./gradlew + - name: Publish to MavenCentral + run: ./gradlew publishToMavenCentral --no-configuration-cache + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY_CONTENTS }} diff --git a/tpstreams-android-player/build.gradle.kts b/tpstreams-android-player/build.gradle.kts index 61769bf..30aa624 100644 --- a/tpstreams-android-player/build.gradle.kts +++ b/tpstreams-android-player/build.gradle.kts @@ -1,12 +1,19 @@ +import com.vanniktech.maven.publish.AndroidSingleVariantLibrary +import com.vanniktech.maven.publish.SonatypeHost + plugins { alias(libs.plugins.android.library) alias(libs.plugins.kotlin.android) id("maven-publish") + id("signing") + id("com.vanniktech.maven.publish") version "0.31.0" } android { - namespace = "com.tpstreams.player" + namespace = "com.tpstreams" compileSdk = 35 + version = "0.0.1" + group = "com.tpstreams" defaultConfig { minSdk = 21 @@ -64,4 +71,32 @@ dependencies { } } } +} + +mavenPublishing { + + publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) + + signAllPublications() + + coordinates(group.toString(), "tpstreams-player", version.toString()) + + pom { + name.set("TPStreamsAndroidPlayer") + description.set("An android sdk for TPStreams Player") + url.set("https://github.com/testpress/TPStreamsAndroidPlayer") + + licenses { + license { + name.set("The Apache License, Version 2.0") + url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") + } + } + + scm { + url.set("https://github.com/testpress/TPStreamsAndroidPlayer") + connection.set("scm:git:git://github.com:testpress/TPStreamsAndroidPlayer.git") + developerConnection.set("scm:git:ssh://gitgithub.com:testpress/TPStreamsAndroidPlayer.git") + } + } } \ No newline at end of file From 61f9d33fe3e4565eeff37cd4376fcf25f6f94aef Mon Sep 17 00:00:00 2001 From: Syed Ibrahim Date: Mon, 2 Jun 2025 15:43:26 +0530 Subject: [PATCH 2/2] fix: typo --- tpstreams-android-player/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tpstreams-android-player/build.gradle.kts b/tpstreams-android-player/build.gradle.kts index 30aa624..549f231 100644 --- a/tpstreams-android-player/build.gradle.kts +++ b/tpstreams-android-player/build.gradle.kts @@ -96,7 +96,7 @@ mavenPublishing { scm { url.set("https://github.com/testpress/TPStreamsAndroidPlayer") connection.set("scm:git:git://github.com:testpress/TPStreamsAndroidPlayer.git") - developerConnection.set("scm:git:ssh://gitgithub.com:testpress/TPStreamsAndroidPlayer.git") + developerConnection.set("scm:git:ssh://github.com:testpress/TPStreamsAndroidPlayer.git") } } } \ No newline at end of file