From abe34e55a443193397c614264052510a55a07751 Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Tue, 23 Sep 2025 15:48:06 +0530 Subject: [PATCH 1/8] Update release workflow and Gradle configuration for Maven Central publishing --- .github/workflows/publish-release.yml | 12 +++++++++--- contentstack/build.gradle | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 8f281843..af4c15a0 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -1,6 +1,9 @@ name: Publish - Release on: + push: + branches: + - fix/release-workflow release: types: [released] @@ -12,6 +15,7 @@ jobs: uses: actions/checkout@v3 - name: Setup Gradle uses: gradle/gradle-build-action@v2 + - name: Setup local.properties run: | cat << EOF >> local.properties @@ -23,15 +27,17 @@ jobs: contentType="${{ secrets.CONTENT_TYPE }}" assetUid="${{ secrets.ASSET_UID }}" EOF + - name: Gradle build and clean run: | ./gradlew clean build - - name: Publish the SDK + + - name: Publish to Maven Central run: | ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache env: - ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.mavenCentralUsername }} - ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.mavenCentralPassword }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_PASSWORD }} ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.signingInMemoryKey }} ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.signingInMemoryKeyId }} ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.signingInMemoryKeyPassword }} \ No newline at end of file diff --git a/contentstack/build.gradle b/contentstack/build.gradle index decfc052..1a414f7a 100755 --- a/contentstack/build.gradle +++ b/contentstack/build.gradle @@ -8,9 +8,9 @@ import com.vanniktech.maven.publish.SonatypeHost android.buildFeatures.buildConfig true mavenPublishing { - publishToMavenCentral(SonatypeHost.DEFAULT) + publishToMavenCentral("OSSRH") // Use OSSRH for Sonatype OSSRH (Maven Central) signAllPublications() - coordinates("com.contentstack.sdk", "android", "4.1.0") + coordinates("com.contentstack.sdk", "android", "4.1.0-beta") pom { name = "contentstack-android" From 64b16306b6a5c32ef8d006baa07bece0a2696cd4 Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Tue, 23 Sep 2025 16:07:42 +0530 Subject: [PATCH 2/8] Enhance Gradle configuration for Maven Central publishing and update release workflow --- .github/workflows/publish-release.yml | 1 + contentstack/build.gradle | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index af4c15a0..05d8cb2b 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -13,6 +13,7 @@ jobs: steps: - name: Checkout project sources uses: actions/checkout@v3 + - name: Setup Gradle uses: gradle/gradle-build-action@v2 diff --git a/contentstack/build.gradle b/contentstack/build.gradle index 1a414f7a..72e15b70 100755 --- a/contentstack/build.gradle +++ b/contentstack/build.gradle @@ -3,12 +3,11 @@ plugins { id "com.android.library" } -import com.vanniktech.maven.publish.SonatypeHost - android.buildFeatures.buildConfig true mavenPublishing { - publishToMavenCentral("OSSRH") // Use OSSRH for Sonatype OSSRH (Maven Central) + // Use OSSRH staging API for Maven Central publishing + publishToMavenCentral("OSSRH", "https://s01.oss.sonatype.org/service/local/") signAllPublications() coordinates("com.contentstack.sdk", "android", "4.1.0-beta") @@ -56,7 +55,8 @@ tasks.register('jacocoTestReport', JacocoReport) { } android { - //namespace "com.contentstack.sdk" + namespace "com.contentstack.sdk" + compileSdk 34 // Using latest stable Android SDK version packagingOptions { exclude("META-INF/DEPENDENCIES") exclude("META-INF/LICENSE") From 24d4ad5a2a5da8860bfcb6c319daa149581c5ac0 Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Tue, 23 Sep 2025 16:22:10 +0530 Subject: [PATCH 3/8] Update release workflow to include JDK and Maven setup, and refine Gradle publishing configuration --- .github/workflows/publish-release.yml | 10 ++++++++++ contentstack/build.gradle | 7 +++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 05d8cb2b..932c37ee 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -14,6 +14,16 @@ jobs: - name: Checkout project sources uses: actions/checkout@v3 + - name: Set up JDK and Maven Central + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + cache: 'gradle' + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + - name: Setup Gradle uses: gradle/gradle-build-action@v2 diff --git a/contentstack/build.gradle b/contentstack/build.gradle index 72e15b70..2acc3c0e 100755 --- a/contentstack/build.gradle +++ b/contentstack/build.gradle @@ -2,12 +2,12 @@ plugins { id "com.vanniktech.maven.publish" version "0.27.0" id "com.android.library" } - +import com.vanniktech.maven.publish.SonatypeHost android.buildFeatures.buildConfig true mavenPublishing { - // Use OSSRH staging API for Maven Central publishing - publishToMavenCentral("OSSRH", "https://s01.oss.sonatype.org/service/local/") + // Use S01 host for Maven Central publishing + publishToMavenCentral(SonatypeHost.S01) signAllPublications() coordinates("com.contentstack.sdk", "android", "4.1.0-beta") @@ -97,7 +97,6 @@ android { keyPassword 'android' } } - compileSdk 30 defaultConfig { // Required when setting minSdkVersion to 20 or lower multiDexEnabled true From 12505d17bde99ecafbe1000fd2b529180a59bc87 Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Tue, 23 Sep 2025 16:29:10 +0530 Subject: [PATCH 4/8] Enhance Gradle properties for Maven Central publishing with additional configuration options --- gradle.properties | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 64b7045d..6ba96609 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,16 @@ android.useAndroidX=true android.enableJetifier=true android.enableR8.fullMode=false -org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m \ No newline at end of file +org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m +android.suppressUnsupportedCompileSdk=34 + +# Maven Central Publishing Configuration +SONATYPE_HOST=S01 +RELEASE_SIGNING_ENABLED=true + +# These values should be provided by environment variables in CI +mavenCentralUsername= +mavenCentralPassword= +signing.keyId= +signing.password= +signing.secretKeyRingFile= \ No newline at end of file From 99273ec2e6ea8f5400a634b7dc4305eadd497f61 Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Wed, 22 Oct 2025 18:32:22 +0530 Subject: [PATCH 5/8] testing release --- .github/workflows/publish-release.yml | 6 +++--- contentstack/build.gradle | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 932c37ee..7a6514e0 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -20,9 +20,9 @@ jobs: java-version: '11' distribution: 'adopt' cache: 'gradle' - server-id: ossrh - server-username: MAVEN_USERNAME - server-password: MAVEN_PASSWORD + server-id: central + server-username: ${{ secrets.MAVEN_USERNAME }} + server-password: ${{ secrets.MAVEN_PASSWORD }} - name: Setup Gradle uses: gradle/gradle-build-action@v2 diff --git a/contentstack/build.gradle b/contentstack/build.gradle index 2acc3c0e..3d978496 100755 --- a/contentstack/build.gradle +++ b/contentstack/build.gradle @@ -1,5 +1,5 @@ plugins { - id "com.vanniktech.maven.publish" version "0.27.0" + id "com.vanniktech.maven.publish" version "0.28.0" id "com.android.library" } import com.vanniktech.maven.publish.SonatypeHost From 269066396ef25390ecf9ade3eee9533946e7fbf2 Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Wed, 29 Oct 2025 11:52:59 +0530 Subject: [PATCH 6/8] fix release workflow --- build.gradle | 3 +- contentstack/build.gradle | 117 +++++++++++++---------- gradle.properties | 4 +- gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 6 ++ 5 files changed, 75 insertions(+), 57 deletions(-) diff --git a/build.gradle b/build.gradle index dfe2f5ec..91743a3f 100644 --- a/build.gradle +++ b/build.gradle @@ -12,8 +12,7 @@ buildscript { } dependencies { - //classpath "com.android.tools.build:gradle:8.2.1" //8.2.1 - classpath 'com.android.tools.build:gradle:7.4.2' + classpath "com.android.tools.build:gradle:8.2.1" classpath 'io.github.gradle-nexus:publish-plugin:2.0.0-rc-1' classpath "org.jacoco:org.jacoco.core:$jacoco_version" } diff --git a/contentstack/build.gradle b/contentstack/build.gradle index 3d978496..12592ea1 100755 --- a/contentstack/build.gradle +++ b/contentstack/build.gradle @@ -1,62 +1,20 @@ plugins { - id "com.vanniktech.maven.publish" version "0.28.0" id "com.android.library" + id "com.vanniktech.maven.publish" version "0.33.0" } -import com.vanniktech.maven.publish.SonatypeHost -android.buildFeatures.buildConfig true -mavenPublishing { - // Use S01 host for Maven Central publishing - publishToMavenCentral(SonatypeHost.S01) - signAllPublications() - coordinates("com.contentstack.sdk", "android", "4.1.0-beta") - - pom { - name = "contentstack-android" - description = "The Content Delivery SDK facilitates the retrieval of content from your Contentstack account, enabling seamless delivery to your web or mobile properties.." - inceptionYear = "2018" - packaging 'aar' - url = "https://github.com/contentstack/contentstack-android" - licenses { - license { - name = "The MIT License" - url = "https://github.com/contentstack/contentstack-android/blob/master/LICENSE" - distribution = "https://github.com/contentstack/contentstack-android/blob/master/LICENSE" - } - } - developers { - developer { - id = "ishaileshmishra" - name = "contentstack" - url = "https://github.com/contentstack/contentstack-android" - } - } - scm { - url = "scm:git@github.com:contentstack/contentstack-android" - connection = "scm:git:git://github.com/contentstack/contentstack-android.git" - developerConnection = "scm:git@github.com:contentstack/contentstack-android.git" - } - } -} - - -tasks.register('jacocoTestReport', JacocoReport) { - dependsOn['testDebugUnitTest', 'createDebugCoverageReport'] - reports { - html.enabled = true - } - afterEvaluate { - classDirectories.setFrom(files(classDirectories.files.collect { - fileTree(dir: it, exclude: '**com/contentstack/okhttp**') - fileTree(dir: it, exclude: '**com/contentstack/okio**') - fileTree(dir: it, exclude: '**com/contentstack/txtmark**') - })) - } +ext { + PUBLISH_GROUP_ID = 'com.contentstack.sdk' + PUBLISH_ARTIFACT_ID = 'android' + PUBLISH_VERSION = '4.1.0-beta' } android { namespace "com.contentstack.sdk" compileSdk 34 // Using latest stable Android SDK version + buildFeatures { + buildConfig true + } packagingOptions { exclude("META-INF/DEPENDENCIES") exclude("META-INF/LICENSE") @@ -203,4 +161,61 @@ tasks.register('createJar', Jar) { include 'com/contentstack/' //include 'META-INF/' } -createJar.dependsOn(clearJar, unzip, build) \ No newline at end of file +createJar.dependsOn(clearJar, unzip, build) + +mavenPublishing { + // Configure the Maven Central publishing target + publishToMavenCentral("CENTRAL_PORTAL") + + // Sign all publications + signAllPublications() + + coordinates(PUBLISH_GROUP_ID, PUBLISH_ARTIFACT_ID, PUBLISH_VERSION) + + pom { + name = "contentstack-android" + description = "The Content Delivery SDK facilitates the retrieval of content from your Contentstack account, enabling seamless delivery to your web or mobile properties.." + inceptionYear = "2018" + packaging 'aar' + url = "https://github.com/contentstack/contentstack-android" + licenses { + license { + name = "The MIT License" + url = "https://github.com/contentstack/contentstack-android/blob/master/LICENSE" + distribution = "https://github.com/contentstack/contentstack-android/blob/master/LICENSE" + } + } + developers { + developer { + id = "ishaileshmishra" + name = "contentstack" + url = "https://github.com/contentstack/contentstack-android" + } + } + scm { + url = "scm:git@github.com:contentstack/contentstack-android" + connection = "scm:git:git://github.com/contentstack/contentstack-android.git" + developerConnection = "scm:git@github.com:contentstack/contentstack-android.git" + } + } +} + +tasks.register('jacocoTestReport', JacocoReport) { + dependsOn('testDebugUnitTest', 'createDebugCoverageReport') + reports { + html.required = true + } +} + +// Configure jacocoTestReport after evaluation when classDirectories is available +project.afterEvaluate { + tasks.named('jacocoTestReport', JacocoReport) { + classDirectories.setFrom(files(classDirectories.files.collect { + fileTree(dir: it, exclude: [ + '**com/contentstack/okhttp**', + '**com/contentstack/okio**', + '**com/contentstack/txtmark**' + ]) + })) + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 6ba96609..e3822e8b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,10 +5,8 @@ org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m android.suppressUnsupportedCompileSdk=34 # Maven Central Publishing Configuration -SONATYPE_HOST=S01 -RELEASE_SIGNING_ENABLED=true - # These values should be provided by environment variables in CI +# For new Central Portal, use Portal Token instead of username/password mavenCentralUsername= mavenCentralPassword= signing.keyId= diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6b0e6c07..536def26 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -2,7 +2,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists #distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip #distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/settings.gradle b/settings.gradle index f699c255..68046e7a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,3 +17,9 @@ dependencyResolutionManagement { } rootProject.name = "contentstack-android" include ':contentstack' + +gradle.beforeProject { project -> + if (project.name == "contentstack") { + project.ext.ANDROID_VARIANT_TO_PUBLISH = "release" + } +} From 04f56d6fdcb3ae4587b121bb3b776b179c34ca48 Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Wed, 29 Oct 2025 11:57:52 +0530 Subject: [PATCH 7/8] fix 2 --- .github/workflows/publish-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 7a6514e0..35406aef 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -17,7 +17,7 @@ jobs: - name: Set up JDK and Maven Central uses: actions/setup-java@v3 with: - java-version: '11' + java-version: '17' distribution: 'adopt' cache: 'gradle' server-id: central From 8854fb1c53e7698ff2bdbf3b688a75a3bd16e17a Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Wed, 29 Oct 2025 12:05:21 +0530 Subject: [PATCH 8/8] reverted branch push --- .github/workflows/publish-release.yml | 3 --- contentstack/build.gradle | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 35406aef..bb04eb8c 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -1,9 +1,6 @@ name: Publish - Release on: - push: - branches: - - fix/release-workflow release: types: [released] diff --git a/contentstack/build.gradle b/contentstack/build.gradle index 12592ea1..25ab9afb 100755 --- a/contentstack/build.gradle +++ b/contentstack/build.gradle @@ -6,7 +6,7 @@ plugins { ext { PUBLISH_GROUP_ID = 'com.contentstack.sdk' PUBLISH_ARTIFACT_ID = 'android' - PUBLISH_VERSION = '4.1.0-beta' + PUBLISH_VERSION = '4.1.0' } android {