Skip to content

Commit 1a30eb1

Browse files
Add jreleaser
1 parent 0938a78 commit 1a30eb1

File tree

4 files changed

+171
-55
lines changed

4 files changed

+171
-55
lines changed

.github/workflows/release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release version'
8+
required: true
9+
dry-run:
10+
description: 'Perform a dry run (skip remote operations)'
11+
type: boolean
12+
required: true
13+
default: false
14+
15+
jobs:
16+
release:
17+
name: Release
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Setup Java
27+
uses: actions/setup-java@v4
28+
with:
29+
java-version: '21'
30+
distribution: 'zulu'
31+
32+
- name: Cache Gradle
33+
uses: actions/cache@v4
34+
with:
35+
path: ~/.gradle/caches
36+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
37+
restore-keys: ${{ runner.os }}-gradle-
38+
39+
- name: Build
40+
run: ./gradlew build
41+
env:
42+
GH_PACKAGES_READ_TOKEN: ${{ secrets.GH_PACKAGES_READ_TOKEN }}
43+
GH_PACKAGES_WRITE_TOKEN: ${{ secrets.GH_PACKAGES_WRITE_TOKEN }}
44+
IPREGISTRY_API_KEY: ${{ secrets.IPREGISTRY_API_KEY }}
45+
IPREGISTRY_DATASETS_SECRET_KEY: ${{ secrets.IPREGISTRY_DATASETS_SECRET_KEY }}
46+
47+
- name: Release with JReleaser
48+
env:
49+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
51+
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
52+
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
53+
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
54+
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
55+
run: |
56+
mkdir -p build/jreleaser
57+
./gradlew jreleaserFullRelease ${{ inputs.dry-run && '--dryrun' || '' }}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Test JReleaser Configuration
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
test_type:
7+
description: 'Test type to run'
8+
required: true
9+
default: 'both'
10+
type: choice
11+
options:
12+
- both
13+
- config
14+
- prepare
15+
- fullrelease
16+
17+
jobs:
18+
test-jreleaser:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Setup Java
28+
uses: actions/setup-java@v4
29+
with:
30+
java-version: '21'
31+
distribution: 'temurin'
32+
33+
- name: Setup Gradle
34+
uses: gradle/actions/setup-gradle@v4
35+
36+
- name: Test JReleaser Config
37+
if: ${{ github.event.inputs.test_type == 'config' || github.event.inputs.test_type == 'both' }}
38+
env:
39+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
run: |
41+
mkdir -p build/jreleaser
42+
./gradlew jreleaserConfig
43+
44+
- name: Test JReleaser Prepare
45+
if: ${{ github.event.inputs.test_type == 'prepare' || github.event.inputs.test_type == 'both' }}
46+
env:
47+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
run: |
49+
mkdir -p build/jreleaser
50+
./gradlew jreleaserPrepare
51+
52+
- name: Test JReleaser Full Release
53+
if: ${{ github.event.inputs.test_type == 'fullrelease' }}
54+
env:
55+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
run: |
57+
mkdir -p build/jreleaser
58+
./gradlew jreleaserFullRelease --dry-run

build.gradle

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import java.text.SimpleDateFormat
22

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

98
group = 'co.ipregistry'
@@ -43,60 +42,7 @@ jar {
4342

4443

4544

46-
publishing {
47-
publications {
48-
mavenJava(MavenPublication) {
49-
groupId = 'co.ipregistry'
50-
artifactId = 'ipregistry-client'
51-
version = project.version
52-
from components.java
53-
54-
pom {
55-
name = 'Ipregistry Java Client'
56-
packaging = 'jar'
57-
description = 'Official Java client for Ipregistry, a fast, reliable IP geolocation and threat data API.'
58-
url = 'https://github.com/ipregistry/ipregistry-java'
59-
60-
developers {
61-
developer {
62-
id = 'ipregistry-team'
63-
name = 'Ipregistry Team'
64-
email = 'support@ipregistry.co'
65-
}
66-
}
67-
68-
licenses {
69-
license {
70-
name = 'The Apache License, Version 2.0'
71-
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
72-
}
73-
}
74-
75-
scm {
76-
connection = 'scm:git:git@github.com:ipregistry/ipregistry-java.git'
77-
developerConnection = 'scm:git:git@github.com:ipregistry/ipregistry-java.git'
78-
url = 'https://github.com/ipregistry/ipregistry-java.git'
79-
}
80-
}
81-
}
82-
}
83-
repositories {
84-
maven {
85-
name = 'OSSRH'
86-
def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
87-
def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
88-
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
89-
credentials {
90-
username = System.getenv('OSSRH_USERNAME')
91-
password = System.getenv('OSSRH_PASSWORD')
92-
}
93-
}
94-
}
95-
}
9645

97-
signing {
98-
sign publishing.publications.mavenJava
99-
}
10046

10147
javadoc {
10248
if(JavaVersion.current().isJava9Compatible()) {

jreleaser.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
project:
2+
name: ipregistry-client
3+
description: Official Java client for Ipregistry, a fast, reliable IP geolocation and threat data API.
4+
longDescription: |
5+
Official Java client for Ipregistry, a fast, reliable IP geolocation and threat data API.
6+
Ipregistry provides accurate IP geolocation, threat intelligence, and network data.
7+
authors:
8+
- Ipregistry Team
9+
license: Apache-2.0
10+
inceptionYear: 2019
11+
website: https://github.com/ipregistry/ipregistry-java
12+
docsUrl: https://ipregistry.co/docs
13+
copyright: 2019-2025 Ipregistry
14+
vendor: Ipregistry
15+
16+
release:
17+
github:
18+
owner: ipregistry
19+
name: ipregistry-java
20+
tagName: '{{projectVersion}}'
21+
releaseName: '{{tagName}}'
22+
overwrite: true
23+
update:
24+
enabled: true
25+
sections:
26+
- TITLE
27+
- BODY
28+
changelog:
29+
enabled: true
30+
formatted: ALWAYS
31+
preset: conventional-commits
32+
33+
deploy:
34+
maven:
35+
mavenCentral:
36+
sonatype:
37+
active: ALWAYS
38+
url: https://central.sonatype.com/api/v1/publisher
39+
stagingRepositories:
40+
- build/staging-deploy
41+
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
52+
53+
signing:
54+
active: ALWAYS
55+
armored: true

0 commit comments

Comments
 (0)