Skip to content

Commit cac518e

Browse files
committed
Publish to maven central 5
1 parent 1eadac5 commit cac518e

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

.github/workflows/publish-maven.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ jobs:
2222
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository
2323
env:
2424
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
25-
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
25+
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
26+
MAVEN_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
27+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

build.gradle

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ if(hasProperty('target') && target == 'android') {
8686

8787
apply plugin: 'java'
8888
apply plugin: 'maven-publish'
89+
apply plugin: 'signing'
8990

9091
sourceCompatibility = JavaVersion.VERSION_11
9192
targetCompatibility = JavaVersion.VERSION_11
@@ -104,11 +105,40 @@ if(hasProperty('target') && target == 'android') {
104105
pom {
105106
name = 'Unit Java SDK'
106107
description = "This library provides a Java SDK to Unit's API."
108+
url = 'https://github.com/unit-finance/unit-openapi-java-sdk'
109+
licenses {
110+
license {
111+
name = 'Mozilla Public License Version 2.0'
112+
url = 'https://www.mozilla.org/MPL/2.0/'
113+
distribution = 'repo'
114+
}
115+
}
116+
scm {
117+
connection = 'scm:git:git://github.com/unit-finance/unit-openapi-java-sdk.git'
118+
developerConnection = 'scm:git:ssh://[email protected]:unit-finance/unit-openapi-java-sdk.git'
119+
url = 'https://github.com/unit-finance/unit-openapi-java-sdk'
120+
}
121+
developers {
122+
developer {
123+
name = 'Unit'
124+
organization = 'Unit Finance'
125+
organizationUrl = 'https://unit.co'
126+
}
127+
}
107128
}
108129
}
109130
}
110131
}
111132

133+
signing {
134+
def signingKey = System.getenv("MAVEN_GPG_PRIVATE_KEY")
135+
def signingPassphrase = System.getenv("MAVEN_GPG_PASSPHRASE")
136+
if (signingKey && signingPassphrase) {
137+
useInMemoryPgpKeys(signingKey, signingPassphrase)
138+
sign publishing.publications.maven
139+
}
140+
}
141+
112142
nexusPublishing {
113143
repositories {
114144
sonatype {

0 commit comments

Comments
 (0)