Skip to content

Commit

Permalink
Merge pull request #2 from telekom/feature/mavenPublishing
Browse files Browse the repository at this point in the history
chore: Introduce maven publishing
  • Loading branch information
chrisingenhaag authored Feb 16, 2024
2 parents ca6ea79 + 5c82ba5 commit 2281397
Show file tree
Hide file tree
Showing 10 changed files with 270 additions and 41 deletions.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: 2024 Deutsche Telekom AG
#
# SPDX-License-Identifier: Apache-2.0

version: 2
updates:
- package-ecosystem: "gradle" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
41 changes: 41 additions & 0 deletions .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# SPDX-FileCopyrightText: 2024 Deutsche Telekom AG
#
# SPDX-License-Identifier: Apache-2.0

name: Gradle Build and Test
on:
push:
pull_request:
branches:
- main
jobs:
gradle:
runs-on: ubuntu-latest

services:
docker:
image: docker:25-dind

steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Execute Gradle build
run: ./gradlew build

- name: Add coverage to PR
id: jacoco
uses: madrapps/[email protected]
with:
paths: |
${{ github.workspace }}/**/build/reports/jacoco/**/jacocoTestReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 60
min-coverage-changed-files: 80
if: github.event_name == 'pull_request'
33 changes: 33 additions & 0 deletions .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# SPDX-FileCopyrightText: 2024 Deutsche Telekom AG
#
# SPDX-License-Identifier: Apache-2.0

name: Gradle Publish
on:
release:
types: [published]
jobs:
gradle:
runs-on: ubuntu-latest

services:
docker:
image: docker:25-dind

steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Execute Gradle publish
env:
PUBLISH_USERNAME: ${{ secrets.PUBLISH_USERNAME }}
PUBLISH_PASSWORD: ${{ secrets.PUBLISH_PASSWORD }}
PUBLISH_GPG_PRIVATE_KEY: ${{ secrets.PUBLISH_GPG_PRIVATE_KEY }}
PUBLISH_GPG_PASSPHRASE: ${{ secrets.PUBLISH_GPG_PASSPHRASE }}
run: ./gradlew -Pversion=${{ github.event.release.name }} publish
4 changes: 2 additions & 2 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
#
# SPDX-License-Identifier: Apache-2.0

[Development][1] @dhei/teams/pandora/pandora-internal
*
# Pubsub-horizon-spring-parent is currently maintained by Telekom's Horizon team.
* @telekom/pubsub-horizon
30 changes: 0 additions & 30 deletions build.gradle

This file was deleted.

2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ hazelcastVersion=4.2.8

# internal
jsonFilterVersion=1.0.1

version=0.0.0-DEVELOPMENT
64 changes: 61 additions & 3 deletions horizon-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ plugins {
id 'io.spring.dependency-management'
id 'maven-publish'
id 'jacoco'
id 'signing'
}

group 'de.telekom.eni'
version "${parentVersion}"

java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
withJavadocJar()
withSourcesJar()
}

dependencyManagement {
Expand Down Expand Up @@ -73,15 +75,57 @@ dependencies {

publishing {
publications {
mavenPublication(MavenPublication) {

mavenJava(MavenPublication) {

from components.java
groupId 'de.telekom.eni'
artifactId 'horizon-core'
version project.version
version = project.properties['version']

pom {
name = 'Horizon spring parent core'
description = 'Spring-boot-starter core library for pubsub horizon java components.'
url = 'https://github.com/telekom/pubsub-horizon-spring-parent'
inceptionYear = '2022'

licenses {
license {
name = 'Apache-2.0'
url = 'https://opensource.org/licenses/Apache-2.0'
}
}
developers {
developer {
id = 'eni-pandora'
name = 'Team Pandora'
email = '[email protected]'
organization = 'Deutsche Telekom IT GmbH'
organizationUrl = 'https://developer.telekom.de/'
}
}
scm {
connection = 'scm:git:git://github.com/telekom/pubsub-horizon-spring-parent.git'
developerConnection = 'scm:git:git://github.com/telekom/pubsub-horizon-spring-parent.git'
url = 'https://github.com/telekom/pubsub-horizon-spring-parent'
}
}
}
}

repositories {
maven {
name = "OSSRH"
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = System.getenv('PUBLISH_USERNAME')
password = System.getenv('PUBLISH_PASSWORD')
}
}
}
}


test {
finalizedBy jacocoTestReport
}
Expand All @@ -96,4 +140,18 @@ jacocoTestReport {

test {
useJUnitPlatform()
}

signing {
def signingKey = new String(Base64.decoder.decode(System.getenv('PUBLISH_GPG_PRIVATE_KEY') ?: ""))
def signingPassword = System.getenv('PUBLISH_GPG_PASSPHRASE')
useInMemoryPgpKeys(signingKey, signingPassword)

sign publishing.publications.mavenJava
}

javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,6 @@ public static StateBuilder builder(Status status, EventMessage message, Evaluati
return builder;
}

public static class StateBuilder {}

}
63 changes: 60 additions & 3 deletions horizon-spring-boot-autoconfigure/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ plugins {
id 'io.spring.dependency-management'
id 'maven-publish'
id 'jacoco'
id 'signing'
}

group 'de.telekom.eni'
version "${parentVersion}"

java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
withJavadocJar()
withSourcesJar()
}

dependencyManagement {
Expand Down Expand Up @@ -46,11 +48,52 @@ dependencies {

publishing {
publications {
mavenPublication(MavenPublication) {

mavenJava(MavenPublication) {

from components.java
groupId 'de.telekom.eni'
artifactId 'horizon-spring-boot-autoconfigure'
version project.version
version = project.properties['version']

pom {
name = 'Horizon spring parent autoconfigure'
description = 'Spring-boot-starter autoconfiguration library for pubsub horizon java components.'
url = 'https://github.com/telekom/pubsub-horizon-spring-parent'
inceptionYear = '2022'

licenses {
license {
name = 'Apache-2.0'
url = 'https://opensource.org/licenses/Apache-2.0'
}
}
developers {
developer {
id = 'eni-pandora'
name = 'Team Pandora'
email = '[email protected]'
organization = 'Deutsche Telekom IT GmbH'
organizationUrl = 'https://developer.telekom.de/'
}
}
scm {
connection = 'scm:git:git://github.com/telekom/pubsub-horizon-spring-parent.git'
developerConnection = 'scm:git:git://github.com/telekom/pubsub-horizon-spring-parent.git'
url = 'https://github.com/telekom/pubsub-horizon-spring-parent'
}
}
}
}

repositories {
maven {
name = "OSSRH"
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = System.getenv('PUBLISH_USERNAME')
password = System.getenv('PUBLISH_PASSWORD')
}
}
}
}
Expand All @@ -66,3 +109,17 @@ jacocoTestReport {
html.required = true
}
}

signing {
def signingKey = new String(Base64.decoder.decode(System.getenv('PUBLISH_GPG_PRIVATE_KEY') ?: ""))
def signingPassword = System.getenv('PUBLISH_GPG_PASSPHRASE')
useInMemoryPgpKeys(signingKey, signingPassword)

sign publishing.publications.mavenJava
}

javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
Loading

0 comments on commit 2281397

Please sign in to comment.