Skip to content

Commit 263ebce

Browse files
Add jreleaser
1 parent 1a30eb1 commit 263ebce

File tree

2 files changed

+61
-2
lines changed

2 files changed

+61
-2
lines changed

.github/workflows/release.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,14 @@ jobs:
4343
GH_PACKAGES_WRITE_TOKEN: ${{ secrets.GH_PACKAGES_WRITE_TOKEN }}
4444
IPREGISTRY_API_KEY: ${{ secrets.IPREGISTRY_API_KEY }}
4545
IPREGISTRY_DATASETS_SECRET_KEY: ${{ secrets.IPREGISTRY_DATASETS_SECRET_KEY }}
46+
47+
- name: Publish artifacts to staging
48+
env:
49+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_SECRET_KEY }}
50+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }}
51+
run: ./gradlew publishMavenPublicationToStagingRepository
4652

47-
- name: Release with JReleaser
53+
- name: Deploy to Maven Central and Create GitHub Release
4854
env:
4955
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5056
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
@@ -54,4 +60,4 @@ jobs:
5460
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
5561
run: |
5662
mkdir -p build/jreleaser
57-
./gradlew jreleaserFullRelease ${{ inputs.dry-run && '--dryrun' || '' }}
63+
./gradlew jreleaserDeploy jreleaserRelease ${{ inputs.dry-run && '--dryrun' || '' }}

build.gradle

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@ import java.text.SimpleDateFormat
22

33
plugins {
44
id 'java-library'
5+
id 'maven-publish'
6+
id 'signing'
57
id 'org.jreleaser' version '1.16.0'
68
}
79

10+
ext {
11+
copyright = '2019-2025 Ipregistry'
12+
}
13+
814
group = 'co.ipregistry'
915
version = '5.0.0'
16+
description = 'Official Java client for Ipregistry, a fast, reliable IP geolocation and threat data API.'
1017

1118
repositories {
1219
mavenCentral()
@@ -104,3 +111,49 @@ test {
104111
integrationTest {
105112
useJUnitPlatform()
106113
}
114+
115+
publishing {
116+
publications {
117+
maven(MavenPublication) {
118+
from components.java
119+
120+
pom {
121+
name = 'Ipregistry Client'
122+
description = 'Official Java client for Ipregistry, a fast, reliable IP geolocation and threat data API.'
123+
url = 'https://github.com/ipregistry/ipregistry-java'
124+
125+
licenses {
126+
license {
127+
name = 'The Apache License, Version 2.0'
128+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
129+
}
130+
}
131+
132+
developers {
133+
developer {
134+
name = 'Ipregistry Team'
135+
organizationUrl = 'https://ipregistry.co'
136+
}
137+
}
138+
139+
scm {
140+
connection = 'scm:git:git://github.com/ipregistry/ipregistry-java.git'
141+
developerConnection = 'scm:git:ssh://github.com:ipregistry/ipregistry-java.git'
142+
url = 'https://github.com/ipregistry/ipregistry-java/tree/main'
143+
}
144+
}
145+
}
146+
}
147+
148+
repositories {
149+
maven {
150+
name = 'staging'
151+
url = layout.buildDirectory.dir('staging-deploy')
152+
}
153+
}
154+
}
155+
156+
signing {
157+
required = { gradle.taskGraph.hasTask('publish') }
158+
sign publishing.publications.maven
159+
}

0 commit comments

Comments
 (0)