Skip to content

Commit d55a5d2

Browse files
Add jreleaser
# Conflicts: # .github/workflows/release.yml # build.gradle
1 parent 1a30eb1 commit d55a5d2

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-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 publishToStagingRepository
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: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ 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

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

0 commit comments

Comments
 (0)