Skip to content

Commit efcb4b8

Browse files
Add jreleaser
1 parent 1a30eb1 commit efcb4b8

File tree

3 files changed

+75
-15
lines changed

3 files changed

+75
-15
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
description: 'Release version'
88
required: true
99
dry-run:
10-
description: 'Perform a dry run (skip remote operations)'
10+
description: 'Dry run'
1111
type: boolean
1212
required: true
1313
default: false
@@ -43,8 +43,11 @@ 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+
run: ./gradlew publish
4649

47-
- name: Release with JReleaser
50+
- name: Deploy to Maven Central and Create GitHub Release
4851
env:
4952
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5053
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
@@ -54,4 +57,9 @@ jobs:
5457
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
5558
run: |
5659
mkdir -p build/jreleaser
57-
./gradlew jreleaserFullRelease ${{ inputs.dry-run && '--dryrun' || '' }}
60+
echo "=== Staging directory contents ==="
61+
find build/staging-deploy -type f -ls || echo "No staging directory found"
62+
echo "=== Running JReleaser Deploy ==="
63+
./gradlew jreleaserDeploy --stacktrace ${{ inputs.dry-run && '--dryrun' || '' }}
64+
echo "=== Running JReleaser Release ==="
65+
./gradlew jreleaserRelease --stacktrace ${{ inputs.dry-run && '--dryrun' || '' }}

build.gradle

Lines changed: 55 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,51 @@ test {
104111
integrationTest {
105112
useJUnitPlatform()
106113
}
114+
115+
publishing {
116+
publications {
117+
maven(MavenPublication) {
118+
groupId = 'co.ipregistry'
119+
artifactId = 'ipregistry-client'
120+
from components.java
121+
122+
pom {
123+
name = 'Ipregistry Client'
124+
description = 'Official Java client for Ipregistry, a fast, reliable IP geolocation and threat data API.'
125+
url = 'https://github.com/ipregistry/ipregistry-java'
126+
127+
licenses {
128+
license {
129+
name = 'The Apache License, Version 2.0'
130+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
131+
}
132+
}
133+
134+
developers {
135+
developer {
136+
name = 'Ipregistry Team'
137+
organizationUrl = 'https://ipregistry.co'
138+
}
139+
}
140+
141+
scm {
142+
connection = 'scm:git:git://github.com/ipregistry/ipregistry-java.git'
143+
developerConnection = 'scm:git:ssh://github.com:ipregistry/ipregistry-java.git'
144+
url = 'https://github.com/ipregistry/ipregistry-java/tree/main'
145+
}
146+
}
147+
}
148+
}
149+
150+
repositories {
151+
maven {
152+
url = layout.buildDirectory.dir('staging-deploy')
153+
}
154+
}
155+
}
156+
157+
// No signing configuration in build.gradle - JReleaser will handle it
158+
159+
jreleaser {
160+
configFile = file('jreleaser.yml')
161+
}

jreleaser.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ project:
88
- Ipregistry Team
99
license: Apache-2.0
1010
inceptionYear: 2019
11-
website: https://github.com/ipregistry/ipregistry-java
12-
docsUrl: https://ipregistry.co/docs
11+
links:
12+
homepage: https://github.com/ipregistry/ipregistry-java
13+
documentation: https://ipregistry.co/docs
1314
copyright: 2019-2025 Ipregistry
1415
vendor: Ipregistry
1516

@@ -39,16 +40,12 @@ deploy:
3940
stagingRepositories:
4041
- build/staging-deploy
4142
applyMavenCentralRules: true
42-
closeRepository: true
43-
releaseRepository: true
44-
45-
distributions:
46-
ipregistry-client:
47-
type: JAVA_BINARY
48-
artifacts:
49-
- path: build/libs/{{distributionName}}-{{projectVersion}}.jar
50-
- path: build/libs/{{distributionName}}-{{projectVersion}}-sources.jar
51-
- path: build/libs/{{distributionName}}-{{projectVersion}}-javadoc.jar
43+
connectTimeout: 300
44+
readTimeout: 1800
45+
maxRetries: 60
46+
retryDelay: 60
47+
skipDeployment: false
48+
failOnExistingDeployment: false
5249

5350
signing:
5451
active: ALWAYS

0 commit comments

Comments
 (0)