Skip to content

Commit

Permalink
Maven Central publishing configuration (#2)
Browse files Browse the repository at this point in the history
* Publishing configuration

* Removed comments
  • Loading branch information
robvadai authored Dec 29, 2024
1 parent e9568e4 commit 5f1cb81
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 63 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
java-version: '17'
- name: Publish
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
OSSRH_USER: ${{ secrets.OSSRH_USER }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
run: gmake publish prerelease=${{ github.event.release.prerelease }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USER }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }}
run: make publish
17 changes: 4 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,8 @@ FONT_ESC := $(shell printf '\033')
FONT_BOLD := ${FONT_ESC}[1m
FONT_NC := ${FONT_ESC}[0m # No colour

PUBLISH_REPOSITORY := release
VERSION := $(shell git describe --tags --match 'v*' --abbrev=0 | cut -c2-)

ifeq (true,$(prerelease))
PUBLISH_REPOSITORY := snapshot
else
ifneq (,$(findstring dev,$(VERSION)))
PUBLISH_REPOSITORY := snapshot
endif
endif

all:
@echo "Use a specific goal. To list all goals, type 'make help'"

Expand Down Expand Up @@ -48,13 +39,13 @@ static-analysis:
security-analysis:
@./gradlew clean dependencyCheckAnalyze

.PHONY: publish-local # Publishes artifacts locally
publish-local:
@./gradlew clean publishToMavenLocal -Pversion=$(VERSION)
# .PHONY: publish-local # Publishes artifacts locally
# publish-local:
# @./gradlew clean publishToMavenLocal -Pversion=$(VERSION)

.PHONY: publish # Publishes artifacts to the configured remote repository
publish:
@./gradlew clean publish -Pversion=$(VERSION) -PpublishRepository=$(PUBLISH_REPOSITORY)
@./gradlew clean publishToMavenCentral -Pversion=$(VERSION)

.PHONY: help # Generate list of goals with descriptions
help:
Expand Down
63 changes: 22 additions & 41 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ plugins {
id 'com.github.maiflai.scalatest' version '0.32' apply false
id 'org.scoverage' version '8.1' apply false
id 'com.github.kt3k.coveralls' version '2.12.2'
id 'maven-publish'
id 'signing'
id "com.vanniktech.maven.publish" version '0.30.0'
}

apply plugin: 'maven-publish'
Expand Down Expand Up @@ -45,52 +44,35 @@ if (project.gradle.startParameter.taskNames.contains('integrationTest')) {
apply from: 'gradle/scala.gradle'
}

publishing {
publications {
maven(MavenPublication) {
pom {
name = 'Kafka Connect Kafka connector'
description = 'A connector with a Kafka sink.'
url = 'https://github.com/Segence/kafka-connect-kafka'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'robvadai'
name = 'Rob Vadai'
email = '[email protected]'
}
}
scm {
url = 'https://github.com/Segence/kafka-connect-kafka'
}
mavenPublishing {
coordinates(project.group, project.name, version)

pom {
name = 'Kafka Connect Kafka connector'
description = 'A connector with a Kafka sink.'
inceptionYear = "2024"
url = 'https://github.com/Segence/kafka-connect-kafka'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
}
repositories {
maven {
url = project.hasProperty('publishRepository') && publishRepository == 'release' ? publishReleaseRepositoryUrl : publishSnapshotRepositoryUrl
credentials {
username System.getenv("OSSRH_USER")
password System.getenv("OSSRH_PASSWORD")
developers {
developer {
id = 'robvadai'
name = 'Rob Vadai'
email = '[email protected]'
}
}
scm {
url = 'https://github.com/Segence/kafka-connect-kafka'
}
}
}

signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}

dependencies {
compileOnly (
api (
"org.apache.kafka:connect-runtime:${kafkaVersion}",
"io.confluent:kafka-schema-registry-client:${confluentVersion}",
"io.confluent:kafka-avro-serializer:${confluentVersion}",
Expand All @@ -102,7 +84,6 @@ dependencies {
"io.confluent:kafka-avro-serializer:${confluentVersion}",
"org.slf4j:slf4j-api:${slf4jVersion}",
"org.slf4j:slf4j-reload4j:${slf4jVersion}",

"org.junit.jupiter:junit-jupiter-api:${junitVersion}",
"org.junit.jupiter:junit-jupiter:${junitVersion}",
"org.junit.platform:junit-platform-runner:${junitPlatformVersion}",
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
systemProp.org.gradle.internal.launcher.welcomeMessageEnabled = false
systemProp.https.protocols = TLSv1,TLSv1.1,TLSv1.2

publishReleaseRepositoryUrl = https://s01.oss.sonatype.org/service/local/staging/deploy/maven2
publishSnapshotRepositoryUrl = https://s01.oss.sonatype.org/content/repositories/snapshots
SONATYPE_HOST=CENTRAL_PORTAL
RELEASE_SIGNING_ENABLED=true

scalaVersions = 2.13.14
defaultScalaVersions = 2.13.14
Expand Down
2 changes: 1 addition & 1 deletion gradle/java.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'com.github.spotbugs'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
Expand Down
1 change: 0 additions & 1 deletion gradle/scala.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ dependencies {
"org.scala-lang:scala-library:%scala-version%",
"org.scalatest:scalatest_%%:${scalaTestVersion}",
"org.scalatestplus:junit-5-10_%%:${scalaTestPlusVersion}",

"io.github.embeddedkafka:embedded-kafka-connect_%%:${embeddedKafkaVersion}",
"io.github.embeddedkafka:embedded-kafka-schema-registry_%%:${confluentVersion}",
"com.softwaremill.sttp.client3:core_%%:${sttpVersion}"
Expand Down

0 comments on commit 5f1cb81

Please sign in to comment.