Skip to content

Commit 5b1cc66

Browse files
committed
Publish to sonatype
1 parent 6479e76 commit 5b1cc66

File tree

7 files changed

+70
-8
lines changed

7 files changed

+70
-8
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,12 @@ jobs:
1313
with:
1414
java-version: 11
1515
- name: Build with Gradle
16-
run: ./gradlew build
16+
run: ./gradlew build
17+
- name: Publish
18+
if: ${{ github.ref == 'refs/heads/main' || startswith(github.ref, 'refs/tags/') }}
19+
env:
20+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.MAVEN_CENTRAL_GPG_KEY }}
21+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.MAVEN_CENTRAL_GPG_PASSWORD }}
22+
ORG_GRADLE_PROJECT_sonatype_username: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
23+
ORG_GRADLE_PROJECT_sonatype_password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
24+
run: ./gradlew publish -PsigningKeyId=CDE3528F

gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
group=eu.xenit.contentcloud
2-
description=An asynchronous client in Java for the OpenPolicyAgent REST API.
32

43
lombokVersion=1.18.16
54
slf4jVersion =1.7.30

gradle/publish.gradle

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
apply plugin: 'maven-publish'
2+
apply plugin: 'signing'
3+
4+
publishing {
5+
publications {
6+
library(MavenPublication) {
7+
from components.java
8+
}
9+
10+
all {
11+
pom {
12+
url = 'https://github.com/xenit-eu/opa-async-java-client'
13+
name = "opa-async-java-client"
14+
description = project.description
15+
16+
scm {
17+
connection = 'scm:git:[email protected]:xenit-eu/opa-async-java-client.git'
18+
developerConnection = 'scm:git:[email protected]:xenit-eu/opa-async-java-client.git'
19+
url = 'https://github.com/xenit-eu/opa-async-java-client.git'
20+
}
21+
22+
developers {
23+
developer {
24+
id = "xenit"
25+
name = "Xenit Solutions NV"
26+
}
27+
}
28+
29+
licenses {
30+
license {
31+
name = 'The Apache License, Version 2.0'
32+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
33+
}
34+
}
35+
}
36+
}
37+
}
38+
39+
repositories {
40+
maven {
41+
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
42+
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
43+
url = version.toString().endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
44+
45+
credentials {
46+
username = project.findProperty('sonatype_username')
47+
password = project.findProperty('sonatype_password')
48+
}
49+
}
50+
}
51+
}
52+
53+
signing {
54+
required { !version.toString().endsWith("SNAPSHOT") }
55+
useInMemoryPgpKeys(findProperty("signingKeyId"), findProperty("signingKey"), findProperty("signingPassword"))
56+
sign publishing.publications
57+
}

opa-async-java-client/build.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ plugins {
22
id 'java-library'
33
}
44

5-
repositories {
6-
mavenCentral()
7-
}
5+
apply from: "${rootDir}/gradle/publish.gradle"
86

97
dependencies {
108
api "org.slf4j:slf4j-api:${slf4jVersion}"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
description=An asynchronous client in Java for the OpenPolicyAgent REST API.

rego-java/build.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ plugins {
22
id 'java-library'
33
}
44

5-
repositories {
6-
mavenCentral()
7-
}
5+
apply from: "${rootDir}/gradle/publish.gradle"
86

97
dependencies {
108
compileOnly "org.projectlombok:lombok:${lombokVersion}"

rego-java/gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
description=Java library for interacting with Rego ASTs

0 commit comments

Comments
 (0)