Skip to content

Commit 337dee7

Browse files
Merge pull request #93 from contentstack/fix/release-workflow
fix release workflow
2 parents 49fd781 + 8854fb1 commit 337dee7

File tree

6 files changed

+104
-61
lines changed

6 files changed

+104
-61
lines changed

.github/workflows/publish-release.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,20 @@ jobs:
1010
steps:
1111
- name: Checkout project sources
1212
uses: actions/checkout@v3
13+
14+
- name: Set up JDK and Maven Central
15+
uses: actions/setup-java@v3
16+
with:
17+
java-version: '17'
18+
distribution: 'adopt'
19+
cache: 'gradle'
20+
server-id: central
21+
server-username: ${{ secrets.MAVEN_USERNAME }}
22+
server-password: ${{ secrets.MAVEN_PASSWORD }}
23+
1324
- name: Setup Gradle
1425
uses: gradle/gradle-build-action@v2
26+
1527
- name: Setup local.properties
1628
run: |
1729
cat << EOF >> local.properties
@@ -23,15 +35,17 @@ jobs:
2335
contentType="${{ secrets.CONTENT_TYPE }}"
2436
assetUid="${{ secrets.ASSET_UID }}"
2537
EOF
38+
2639
- name: Gradle build and clean
2740
run: |
2841
./gradlew clean build
29-
- name: Publish the SDK
42+
43+
- name: Publish to Maven Central
3044
run: |
3145
./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
3246
env:
33-
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.mavenCentralUsername }}
34-
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.mavenCentralPassword }}
47+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_USERNAME }}
48+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_PASSWORD }}
3549
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.signingInMemoryKey }}
3650
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.signingInMemoryKeyId }}
3751
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.signingInMemoryKeyPassword }}

build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ buildscript {
1212
}
1313

1414
dependencies {
15-
//classpath "com.android.tools.build:gradle:8.2.1" //8.2.1
16-
classpath 'com.android.tools.build:gradle:7.4.2'
15+
classpath "com.android.tools.build:gradle:8.2.1"
1716
classpath 'io.github.gradle-nexus:publish-plugin:2.0.0-rc-1'
1817
classpath "org.jacoco:org.jacoco.core:$jacoco_version"
1918
}

contentstack/build.gradle

Lines changed: 68 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,20 @@
11
plugins {
2-
id "com.vanniktech.maven.publish" version "0.27.0"
32
id "com.android.library"
3+
id "com.vanniktech.maven.publish" version "0.33.0"
44
}
55

6-
import com.vanniktech.maven.publish.SonatypeHost
7-
8-
android.buildFeatures.buildConfig true
9-
10-
mavenPublishing {
11-
publishToMavenCentral(SonatypeHost.DEFAULT)
12-
signAllPublications()
13-
coordinates("com.contentstack.sdk", "android", "4.1.0")
14-
15-
pom {
16-
name = "contentstack-android"
17-
description = "The Content Delivery SDK facilitates the retrieval of content from your Contentstack account, enabling seamless delivery to your web or mobile properties.."
18-
inceptionYear = "2018"
19-
packaging 'aar'
20-
url = "https://github.com/contentstack/contentstack-android"
21-
licenses {
22-
license {
23-
name = "The MIT License"
24-
url = "https://github.com/contentstack/contentstack-android/blob/master/LICENSE"
25-
distribution = "https://github.com/contentstack/contentstack-android/blob/master/LICENSE"
26-
}
27-
}
28-
developers {
29-
developer {
30-
id = "ishaileshmishra"
31-
name = "contentstack"
32-
url = "https://github.com/contentstack/contentstack-android"
33-
}
34-
}
35-
scm {
36-
url = "scm:git@github.com:contentstack/contentstack-android"
37-
connection = "scm:git:git://github.com/contentstack/contentstack-android.git"
38-
developerConnection = "scm:git@github.com:contentstack/contentstack-android.git"
39-
}
40-
}
41-
}
42-
43-
44-
tasks.register('jacocoTestReport', JacocoReport) {
45-
dependsOn['testDebugUnitTest', 'createDebugCoverageReport']
46-
reports {
47-
html.enabled = true
48-
}
49-
afterEvaluate {
50-
classDirectories.setFrom(files(classDirectories.files.collect {
51-
fileTree(dir: it, exclude: '**com/contentstack/okhttp**')
52-
fileTree(dir: it, exclude: '**com/contentstack/okio**')
53-
fileTree(dir: it, exclude: '**com/contentstack/txtmark**')
54-
}))
55-
}
6+
ext {
7+
PUBLISH_GROUP_ID = 'com.contentstack.sdk'
8+
PUBLISH_ARTIFACT_ID = 'android'
9+
PUBLISH_VERSION = '4.1.0'
5610
}
5711

5812
android {
59-
//namespace "com.contentstack.sdk"
13+
namespace "com.contentstack.sdk"
14+
compileSdk 34 // Using latest stable Android SDK version
15+
buildFeatures {
16+
buildConfig true
17+
}
6018
packagingOptions {
6119
exclude("META-INF/DEPENDENCIES")
6220
exclude("META-INF/LICENSE")
@@ -97,7 +55,6 @@ android {
9755
keyPassword 'android'
9856
}
9957
}
100-
compileSdk 30
10158
defaultConfig {
10259
// Required when setting minSdkVersion to 20 or lower
10360
multiDexEnabled true
@@ -204,4 +161,61 @@ tasks.register('createJar', Jar) {
204161
include 'com/contentstack/'
205162
//include 'META-INF/'
206163
}
207-
createJar.dependsOn(clearJar, unzip, build)
164+
createJar.dependsOn(clearJar, unzip, build)
165+
166+
mavenPublishing {
167+
// Configure the Maven Central publishing target
168+
publishToMavenCentral("CENTRAL_PORTAL")
169+
170+
// Sign all publications
171+
signAllPublications()
172+
173+
coordinates(PUBLISH_GROUP_ID, PUBLISH_ARTIFACT_ID, PUBLISH_VERSION)
174+
175+
pom {
176+
name = "contentstack-android"
177+
description = "The Content Delivery SDK facilitates the retrieval of content from your Contentstack account, enabling seamless delivery to your web or mobile properties.."
178+
inceptionYear = "2018"
179+
packaging 'aar'
180+
url = "https://github.com/contentstack/contentstack-android"
181+
licenses {
182+
license {
183+
name = "The MIT License"
184+
url = "https://github.com/contentstack/contentstack-android/blob/master/LICENSE"
185+
distribution = "https://github.com/contentstack/contentstack-android/blob/master/LICENSE"
186+
}
187+
}
188+
developers {
189+
developer {
190+
id = "ishaileshmishra"
191+
name = "contentstack"
192+
url = "https://github.com/contentstack/contentstack-android"
193+
}
194+
}
195+
scm {
196+
url = "scm:git@github.com:contentstack/contentstack-android"
197+
connection = "scm:git:git://github.com/contentstack/contentstack-android.git"
198+
developerConnection = "scm:git@github.com:contentstack/contentstack-android.git"
199+
}
200+
}
201+
}
202+
203+
tasks.register('jacocoTestReport', JacocoReport) {
204+
dependsOn('testDebugUnitTest', 'createDebugCoverageReport')
205+
reports {
206+
html.required = true
207+
}
208+
}
209+
210+
// Configure jacocoTestReport after evaluation when classDirectories is available
211+
project.afterEvaluate {
212+
tasks.named('jacocoTestReport', JacocoReport) {
213+
classDirectories.setFrom(files(classDirectories.files.collect {
214+
fileTree(dir: it, exclude: [
215+
'**com/contentstack/okhttp**',
216+
'**com/contentstack/okio**',
217+
'**com/contentstack/txtmark**'
218+
])
219+
}))
220+
}
221+
}

gradle.properties

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
android.useAndroidX=true
22
android.enableJetifier=true
33
android.enableR8.fullMode=false
4-
org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m
4+
org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m
5+
android.suppressUnsupportedCompileSdk=34
6+
7+
# Maven Central Publishing Configuration
8+
# These values should be provided by environment variables in CI
9+
# For new Central Portal, use Portal Token instead of username/password
10+
mavenCentralUsername=
11+
mavenCentralPassword=
12+
signing.keyId=
13+
signing.password=
14+
signing.secretKeyRingFile=

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
#distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
44
#distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
66
networkTimeout=10000
77
validateDistributionUrl=true
88
zipStoreBase=GRADLE_USER_HOME

settings.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,9 @@ dependencyResolutionManagement {
1717
}
1818
rootProject.name = "contentstack-android"
1919
include ':contentstack'
20+
21+
gradle.beforeProject { project ->
22+
if (project.name == "contentstack") {
23+
project.ext.ANDROID_VARIANT_TO_PUBLISH = "release"
24+
}
25+
}

0 commit comments

Comments
 (0)