Skip to content

Commit 689bb98

Browse files
authored
github packages release configuration removed (#14)
1 parent 81b15b9 commit 689bb98

File tree

8 files changed

+140
-118
lines changed

8 files changed

+140
-118
lines changed

.github/workflows/gradle-publish.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

artifact/release-3.1.2.zip

-910 KB
Binary file not shown.

build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,21 @@ buildscript {
99
//noinspection GroovyAssignabilityCheck,GroovyUntypedAccess
1010
dependencies {
1111
classpath 'com.android.tools.build:gradle:3.5.4'
12+
classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
1213
// NOTE: Do not place your application dependencies here; they belong
1314
// in the individual module build.gradle files
1415
}
1516
}
1617

18+
// plugins required for publishing to maven central
19+
plugins {
20+
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
21+
}
22+
23+
apply plugin: 'io.github.gradle-nexus.publish-plugin'
24+
25+
apply from: "${rootDir}/sonatype.gradle"
26+
1727
allprojects {
1828
repositories {
1929
google()

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@
1212
# This option should only be used with decoupled projects. More details, visit
1313
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1414
# org.gradle.parallel=true
15+
ossrhUsername=ossrhUsername
16+
ossrhPassword=ossrhPassword

sonatype.gradle

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Create variables with empty default values
2+
ext["signing.keyId"] = ''
3+
ext["signing.password"] = ''
4+
ext["signing.secretKeyRingFile"] = ''
5+
ext["ossrhUsername"] = ''
6+
ext["ossrhPassword"] = ''
7+
ext["sonatypeStagingProfileId"] = ''
8+
9+
File secretPropsFile = project.rootProject.file('local.properties')
10+
if (secretPropsFile.exists()) {
11+
println "Found secret props file, loading props"
12+
Properties p = new Properties()
13+
p.load(new FileInputStream(secretPropsFile))
14+
p.each { name, value ->
15+
ext[name] = value
16+
}
17+
} else {
18+
println "No props file, loading env vars"
19+
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
20+
ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
21+
ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY')
22+
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
23+
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
24+
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
25+
}
26+
27+
// Set up Sonatype repository
28+
nexusPublishing {
29+
repositories {
30+
sonatype {
31+
stagingProfileId = sonatypeStagingProfileId
32+
username = ossrhUsername
33+
password = ossrhPassword
34+
}
35+
}
36+
}

zapp-merchant-library/build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ apply plugin: 'com.android.library'
22
apply plugin: 'jacoco'
33

44
ext {
5-
PUBLISH_GROUP_ID = 'com.zapp.library'
6-
PUBLISH_ARTIFACT_ID = 'merchant'
5+
PUBLISH_GROUP_ID = 'com.mastercard.pbba'
6+
PUBLISH_ARTIFACT_ID = 'merchant-sdk'
77
PUBLISH_VERSION = '3.1.2'
88
}
99

@@ -14,7 +14,7 @@ android {
1414

1515
defaultConfig {
1616
minSdkVersion 9
17-
targetSdkVersion 30
17+
targetSdkVersion 29
1818
versionCode 3120
1919
versionName '3.1.2'
2020
vectorDrawables.useSupportLibrary = true
@@ -56,4 +56,5 @@ dependencies {
5656
androidTestImplementation 'com.android.support.test.espresso:espresso-intents:3.0.2'
5757
}
5858

59-
apply from: 'release.gradle'
59+
apply from: 'release.gradle'
60+
apply from: 'sonatype-publish.gradle'

zapp-merchant-library/release.gradle

Lines changed: 4 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// ./gradlew clean build :zapp-merchant-library:generateLibraryRelease
22
apply plugin: 'maven'
3-
apply plugin: 'maven-publish'
43

54
def localReleaseDest = "${buildDir}/release/${version}"
65

@@ -15,78 +14,15 @@ afterEvaluate {
1514
//variant.javaCompile.classpath.files
1615
variant.javaCompileProvider.get().classpath.files
1716
})
18-
19-
publishing {
20-
publications {
21-
library(MavenPublication) {
22-
groupId project.PUBLISH_GROUP_ID
23-
artifactId project.PUBLISH_ARTIFACT_ID
24-
version project.PUBLISH_VERSION
25-
artifact sourcesJar
26-
artifact bundleReleaseAar
27-
28-
pom {
29-
name = 'PbBa Merchant Button Library - Android'
30-
description = 'The Pay by Bank app Merchant Library for Android makes it easy for you to add Pay by Bank app as a new payment method.'
31-
32-
url = 'https://github.com/Mastercard/pbba-merchant-button-library-android'
33-
organization {
34-
name = 'Mastercard Zapp'
35-
url = 'https://mastercard.com'
36-
}
37-
licenses {
38-
license {
39-
name = 'The MIT License (MIT)'
40-
url = 'http://www.opensource.org/licenses/mit-license.php'
41-
}
42-
}
43-
developers {
44-
developer {
45-
name = 'Mastercard Zapp'
46-
}
47-
}
48-
scm {
49-
url = 'https://github.com/Mastercard/pbba-merchant-button-library-android'
50-
connection = 'scm:git:git://github.com:Mastercard/pbba-merchant-button-library-android.git'
51-
developerConnection = 'scm:git:ssh://[email protected]:Mastercard/pbba-merchant-button-library-android.git'
52-
}
53-
54-
withXml {
55-
def dependenciesNode = asNode().appendNode('dependencies')
56-
57-
project.configurations.implementation.allDependencies.each {
58-
if (it.name != 'unspecified') {
59-
def dependencyNode = dependenciesNode.appendNode('dependency')
60-
dependencyNode.appendNode('groupId', it.group)
61-
dependencyNode.appendNode('artifactId', it.name)
62-
dependencyNode.appendNode('version', it.version)
63-
}
64-
}
65-
}
66-
}
67-
}
68-
}
69-
70-
repositories {
71-
maven {
72-
name = "GitHubPackages"
73-
url = uri("https://maven.pkg.github.com/Mastercard/pbba-merchant-button-library-android")
74-
credentials {
75-
username = System.getenv("USERNAME")
76-
password = System.getenv("TOKEN")
77-
}
78-
}
79-
}
80-
}
8117
}
8218

8319
task javadocsJar(type: Jar, dependsOn: javadocs) {
84-
archiveClassifier.set("javadoc")
20+
archiveClassifier.set('javadoc')
8521
from javadocs.destinationDir
8622
}
8723

8824
task sourcesJar(type: Jar) {
89-
archiveClassifier.set("sources")
25+
archiveClassifier.set('sources')
9026
from android.sourceSets.main.java.srcDirs
9127
}
9228

@@ -101,21 +37,20 @@ uploadArchives {
10137
}
10238

10339
task zipRelease(type: Zip) {
40+
dependsOn uploadArchives
10441
from localReleaseDest
10542
destinationDir buildDir
10643
archiveName "release-${project.PUBLISH_VERSION}.zip"
10744
}
10845

10946
task generateLibraryRelease {
47+
dependsOn zipRelease
11048
doLast {
11149
println "Release ${project.PUBLISH_VERSION} can be found at ${localReleaseDest}/"
11250
println "Release ${project.PUBLISH_VERSION} zipped can be found ${buildDir}/release-${project.PUBLISH_VERSION}.zip"
11351
}
11452
}
11553

116-
generateLibraryRelease.dependsOn(uploadArchives)
117-
generateLibraryRelease.dependsOn(zipRelease)
118-
11954
artifacts {
12055
archives sourcesJar
12156
archives javadocsJar
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
apply plugin: 'maven-publish'
2+
apply plugin: 'signing'
3+
4+
task androidSourcesJar(type: Jar) {
5+
archiveClassifier.set("sources")
6+
from android.sourceSets.main.java.srcDirs
7+
}
8+
9+
afterEvaluate {
10+
11+
publishing {
12+
publications {
13+
library(MavenPublication) {
14+
groupId project.PUBLISH_GROUP_ID
15+
artifactId project.PUBLISH_ARTIFACT_ID
16+
version project.PUBLISH_VERSION
17+
artifact androidSourcesJar
18+
artifact bundleReleaseAar
19+
20+
pom {
21+
name = 'PbBa Merchant Button Library - Android'
22+
description = 'The Pay by Bank app Merchant Library for Android makes it easy for you to add Pay by Bank app as a new payment method.'
23+
24+
url = 'https://github.com/Mastercard/pbba-merchant-button-library-android'
25+
organization {
26+
name = 'Mastercard Zapp'
27+
url = 'https://mastercard.com'
28+
}
29+
licenses {
30+
license {
31+
name = 'Apache License'
32+
url = 'http://www.apache.org/licenses/LICENSE-2.0'
33+
}
34+
}
35+
developers {
36+
developer {
37+
name = 'Mastercard Zapp'
38+
}
39+
}
40+
scm {
41+
url = 'https://github.com/Mastercard/pbba-merchant-button-library-android'
42+
connection = 'scm:git:git://github.com:Mastercard/pbba-merchant-button-library-android'
43+
developerConnection = 'scm:git:ssh://[email protected]:Mastercard/pbba-merchant-button-library-android'
44+
}
45+
46+
withXml {
47+
def dependenciesNode = asNode().appendNode('dependencies')
48+
49+
project.configurations.implementation.allDependencies.each {
50+
if (it.name != 'unspecified') {
51+
def dependencyNode = dependenciesNode.appendNode('dependency')
52+
dependencyNode.appendNode('groupId', it.group)
53+
dependencyNode.appendNode('artifactId', it.name)
54+
dependencyNode.appendNode('version', it.version)
55+
}
56+
}
57+
}
58+
}
59+
}
60+
}
61+
repositories {
62+
// The repository to publish to, Sonatype/MavenCentral
63+
maven {
64+
// This is an arbitrary name, you may also use "mavencentral" or
65+
// any other name that's descriptive for you
66+
name = "sonatype"
67+
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
68+
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
69+
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
70+
71+
credentials {
72+
username ossrhUsername
73+
password ossrhPassword
74+
}
75+
}
76+
}
77+
}
78+
79+
signing {
80+
sign publishing.publications
81+
//sign configurations.archives
82+
}
83+
}

0 commit comments

Comments
 (0)