Skip to content

Commit 812395f

Browse files
committed
Support com.vanniktech.maven.publish
1 parent d35b3e0 commit 812395f

File tree

2 files changed

+28
-54
lines changed

2 files changed

+28
-54
lines changed

.github/workflows/release-publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ jobs:
3535
env:
3636
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY }}
3737
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY_PASSWORD }}
38-
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
39-
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
38+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
39+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
4040
steps:
4141
- name: Checkout
4242
uses: actions/checkout@v4
@@ -53,7 +53,7 @@ jobs:
5353
cache: "gradle"
5454

5555
- name: Publish to Maven Central
56-
run: ./gradlew publishMavenPublicationToSonatypeRepository -PVERSION=${{ steps.version.outputs.version }}
56+
run: ./gradlew publishAndReleaseToMavenCentral -PVERSION=${{ steps.version.outputs.version }}
5757

5858
create-github-release:
5959
name: Create GitHub Release

build.gradle

Lines changed: 25 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
plugins {
22
id 'java-library'
3-
id 'maven-publish'
4-
id 'signing'
3+
id 'com.vanniktech.maven.publish' version '0.30.0'
54
}
65

76
group = 'com.mparticle'
@@ -14,11 +13,6 @@ repositories {
1413
sourceCompatibility = JavaVersion.VERSION_1_8
1514
targetCompatibility = JavaVersion.VERSION_1_8
1615

17-
java {
18-
withSourcesJar()
19-
withJavadocJar()
20-
}
21-
2216
javadoc {
2317
title = 'mParticle Server Events SDK API Reference'
2418
options.noTimestamp = true
@@ -51,53 +45,33 @@ dependencies {
5145
testImplementation "org.slf4j:slf4j-api:$slf4j_version"
5246
}
5347

54-
publishing {
55-
publications {
56-
maven(MavenPublication) {
57-
from components.java
58-
groupId = 'com.mparticle'
59-
artifactId = 'server-events-sdk'
60-
pom {
61-
name = 'mParticle server-side Java SDK'
62-
description = 'mParticle SDK for server-side Java environments'
63-
url = 'https://github.com/mparticle/mparticle-java-events-sdk'
64-
licenses {
65-
license {
66-
name = 'The Apache Software License, Version 2.0'
67-
url = 'http://www.apache.org/license/LICENSE-2.0.txt'
68-
}
69-
}
70-
scm {
71-
url = 'https://github.com/mparticle/mparticle-java-events-sdk'
72-
connection = 'scm:git:https://github.com/mparticle/mparticle-java-events-sdk'
73-
developerConnection = 'scm:git:git@github.com:mparticle/mparticle-java-events-sdk.git'
74-
}
75-
developers {
76-
developer {
77-
id = 'mParticle'
78-
name = 'mParticle Inc.'
79-
email = 'developers@mparticle.com'
80-
}
81-
}
48+
mavenPublishing {
49+
publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.CENTRAL_PORTAL)
50+
signAllPublications()
51+
52+
coordinates('com.mparticle', 'server-events-sdk', version.toString())
53+
54+
pom {
55+
name = 'mParticle server-side Java SDK'
56+
description = 'mParticle SDK for server-side Java environments'
57+
url = 'https://github.com/mparticle/mparticle-java-events-sdk'
58+
licenses {
59+
license {
60+
name = 'The Apache Software License, Version 2.0'
61+
url = 'http://www.apache.org/license/LICENSE-2.0.txt'
8262
}
8363
}
84-
}
85-
repositories {
86-
maven {
87-
name = 'sonatype'
88-
url = 'https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/'
89-
credentials {
90-
username = System.getenv('sonatypeUsername')
91-
password = System.getenv('sonatypePassword')
64+
scm {
65+
url = 'https://github.com/mparticle/mparticle-java-events-sdk'
66+
connection = 'scm:git:https://github.com/mparticle/mparticle-java-events-sdk'
67+
developerConnection = 'scm:git:git@github.com:mparticle/mparticle-java-events-sdk.git'
68+
}
69+
developers {
70+
developer {
71+
id = 'mParticle'
72+
name = 'mParticle Inc.'
73+
email = 'developers@mparticle.com'
9274
}
9375
}
9476
}
9577
}
96-
97-
def signingKey = System.getenv('ORG_GRADLE_PROJECT_signingInMemoryKey')
98-
def signingPassword = System.getenv('ORG_GRADLE_PROJECT_signingInMemoryKeyPassword')
99-
signing {
100-
required { gradle.taskGraph.hasTask('publishMavenPublicationToSonatypeRepository') }
101-
useInMemoryPgpKeys(signingKey, signingPassword)
102-
sign publishing.publications.maven
103-
}

0 commit comments

Comments
 (0)