Skip to content

Commit

Permalink
[CI] Migrate Maven-Release to ESRP-Release task (#1022)
Browse files Browse the repository at this point in the history
* Migrate AppCenterReactNativeShared to MavenPublication

* Update URL

* Correct numeration

---------

Co-authored-by: Dmitriy Kirakosyan <[email protected]>
  • Loading branch information
AnatolyPristensky and DmitriyKirakosyan authored Jan 9, 2024
1 parent 8f52f5d commit 3561378
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 71 deletions.
117 changes: 51 additions & 66 deletions AppCenterReactNativeShared/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,89 +5,74 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.android.tools.build:gradle:4.2.1'
}
}

repositories {
google()
mavenCentral()
}

apply from: 'publish.gradle'
apply from: 'version.gradle'

apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.android.library'

def wasSigned = false

allprojects {
repositories {
google()
mavenCentral()
jcenter {
content {
// https://youtrack.jetbrains.com/issue/IDEA-261387
includeModule("org.jetbrains.trove4j", "trove4j")
}
def ext = rootProject.ext

// Setup signing values.
ext."signing.keyId" = ext.mavenSigningKeyId
ext."signing.secretKeyRingFile" = ext.mavenSecretKeyPath
ext."signing.password" = ext.mavenPublicKeyPassword

android {
compileSdkVersion 29
buildToolsVersion '29.0.2'

defaultConfig {
minSdkVersion 21
targetSdkVersion 29
versionCode 66
versionName '5.0.1'
group groupId
version versionName
buildConfigField 'String', "SDK_NAME", "\"appcenter.react-native\""
buildConfigField 'String', 'VERSION_NAME', "\"${ext.versionName}\""

ndk {
abiFilters "armeabi-v7a", "x86"
}
consumerProguardFiles 'proguard-rules.pro'
}
}

def ext = rootProject.ext

// Setup signing values.
ext."signing.keyId" = ext.mavenSigningKeyId
ext."signing.secretKeyRingFile" = ext.mavenSecretKeyPath
ext."signing.password" = ext.mavenPublicKeyPassword

android {
compileSdkVersion 29
buildToolsVersion '29.0.2'

defaultConfig {
minSdkVersion 21
targetSdkVersion 29
versionCode 66
versionName '5.0.1'
group groupId
version versionName
buildConfigField 'String', "SDK_NAME", "\"appcenter.react-native\""

ndk {
abiFilters "armeabi-v7a", "x86"
}
consumerProguardFiles 'proguard-rules.pro'
}
task sourcesJar(type: Jar) {
afterEvaluate {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
}

task sourcesJar(type: Jar) {
afterEvaluate {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
publishing {
repositories {
maven {
url = uri("${System.env.BUILD_DIR}")
}
}


afterEvaluate {
uploadArchives {
repositories.mavenDeployer {
beforeDeployment { MavenDeployment deployment ->
// workaround to prevent the script from failing because of double uploading of pom files
// related issue: https://github.com/gradle/gradle/issues/3003
if (!wasSigned) {
signing.signPom(deployment)
wasSigned = true
}
}

repository(url: ext.mavenRepoUrl) {
authentication(userName: ext.mavenUser, password: ext.mavenKey)
}
afterEvaluate { project ->
publications {
maven(MavenPublication) {
from components.release

pom.project {
artifact sourcesJar

// Set base information about assemble.
pom {
packaging = 'aar'
name = project.name
description = sdkDescription
Expand Down Expand Up @@ -135,6 +120,6 @@ artifacts {
}

signing {
required { gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
required { gradle.taskGraph.hasTask("publish") }
sign publishing.publications
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
5 changes: 5 additions & 0 deletions AppCenterReactNativeShared/android/version.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Bintray constants

ext {
versionName = '5.0.1'
}
7 changes: 3 additions & 4 deletions scripts/put-maven-secrets-gradle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
cat >> AppCenterReactNativeShared/android/local.properties << EOL
maven.user=${1:-$MAVEN_USER}
maven.key=${2:-$MAVEN_KEY}
maven.repoUrl=${3:-$MAVEN_REPO}
maven.signingKeyId=${4:-$GDP_SIGNING_KEY_ID}
maven.secretKeyPath=${5:-$GDP_KEY_SECRET_PATH}
maven.publicKeyPassword=${6:-$GDP_KEY_PASSWORD}
maven.signingKeyId=${3:-$GDP_SIGNING_KEY_ID}
maven.secretKeyPath=${4:-$GDP_KEY_SECRET_PATH}
maven.publicKeyPassword=${5:-$GDP_KEY_PASSWORD}
EOL

0 comments on commit 3561378

Please sign in to comment.