Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,20 @@ jobs:
steps:
- name: Checkout project sources
uses: actions/checkout@v3

- name: Set up JDK and Maven Central
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: 'gradle'
server-id: central
server-username: ${{ secrets.MAVEN_USERNAME }}
server-password: ${{ secrets.MAVEN_PASSWORD }}

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Setup local.properties
run: |
cat << EOF >> local.properties
Expand All @@ -23,15 +35,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 }}
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
122 changes: 68 additions & 54 deletions contentstack/build.gradle
Original file line number Diff line number Diff line change
@@ -1,62 +1,20 @@
plugins {
id "com.vanniktech.maven.publish" version "0.27.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 {
publishToMavenCentral(SonatypeHost.DEFAULT)
signAllPublications()
coordinates("com.contentstack.sdk", "android", "4.1.0")

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'
}

android {
//namespace "com.contentstack.sdk"
namespace "com.contentstack.sdk"
compileSdk 34 // Using latest stable Android SDK version
buildFeatures {
buildConfig true
}
packagingOptions {
exclude("META-INF/DEPENDENCIES")
exclude("META-INF/LICENSE")
Expand Down Expand Up @@ -97,7 +55,6 @@ android {
keyPassword 'android'
}
}
compileSdk 30
defaultConfig {
// Required when setting minSdkVersion to 20 or lower
multiDexEnabled true
Expand Down Expand Up @@ -204,4 +161,61 @@ tasks.register('createJar', Jar) {
include 'com/contentstack/'
//include 'META-INF/'
}
createJar.dependsOn(clearJar, unzip, build)
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**'
])
}))
}
}
12 changes: 11 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
android.useAndroidX=true
android.enableJetifier=true
android.enableR8.fullMode=false
org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m
org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m
android.suppressUnsupportedCompileSdk=34

# Maven Central Publishing Configuration
# 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=
signing.password=
signing.secretKeyRingFile=
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Loading