Skip to content

Commit 3591f9c

Browse files
authored
publish to maven central (#12)
* publish to maven central * dont use depot in public repo
1 parent 0f793c5 commit 3591f9c

File tree

7 files changed

+293
-172
lines changed

7 files changed

+293
-172
lines changed

.github/workflows/build-and-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ jobs:
1111
include:
1212
- platform: ubuntu-latest
1313
systemIdentifier: 'linux-x64'
14-
- platform: depot-ubuntu-24.04-arm
14+
- platform: ubuntu-24.04-arm
1515
systemIdentifier: 'linux-arm64'
1616
- platform: macos-13 # last macOS version with x86_64 support
1717
systemIdentifier: 'darwin-x64'
18-
- platform: depot-macos-latest
18+
- platform: macos-latest
1919
systemIdentifier: 'darwin-arm64'
2020
runs-on: ${{ matrix.platform }}
2121
steps:

.github/workflows/release.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,15 @@ jobs:
5353
- name: Build multiplatform jar
5454
run: |
5555
cd jpostal
56-
./gradlew publish
56+
./gradlew publish --info
57+
./gradlew jreleaserDeploy --info
5758
env:
58-
GITHUB_USERNAME: ${{ github.actor }}
59-
GITHUB_TOKEN: ${{ secrets.GH_PKG_WRITE_TOKEN }}
59+
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.MAVEN_GPG_PUBLIC_KEY }}
60+
JRELEASER_GPG_SECRET_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
61+
JRELEASER_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
62+
# For releases
63+
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVEN_USERNAME }}
64+
JRELEASER_MAVENCENTRAL_PASSWORD,: ${{ secrets.MAVEN_PASSWORD }}
65+
# For snapshots
66+
JRELEASER_NEXUS2_USERNAME: ${{ secrets.MAVEN_USERNAME }}
67+
JRELEASER_NEXUS2_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}

build.gradle

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ plugins {
55
id 'java'
66
id 'application'
77
id 'maven-publish'
8+
id 'org.jreleaser' version '1.19.0'
89
}
910

10-
// The latest libpostal release is 1.1.0, but there are many unreleased changes in the master branch
11-
version = '1.2.1'
11+
group = 'com.wherobots'
12+
version = '1.2.1-SNAPSHOT'
1213

1314
repositories {
1415
mavenCentral()
@@ -111,7 +112,6 @@ jar {
111112
}
112113

113114

114-
115115
java {
116116
withJavadocJar()
117117
withSourcesJar()
@@ -122,12 +122,10 @@ sourcesJar.duplicatesStrategy DuplicatesStrategy.EXCLUDE
122122
// Configure publishing
123123
publishing {
124124
publications {
125-
mavenJava(MavenPublication) {
126-
from components.java
127-
128-
groupId = 'com.wherobots'
125+
maven(MavenPublication) {
129126
artifactId = 'jpostal'
130-
version = project.version
127+
128+
from components.java
131129

132130
pom {
133131
name = 'jpostal'
@@ -146,7 +144,7 @@ publishing {
146144
developer {
147145
id = 'james-willis'
148146
name = 'James Willis'
149-
email = 'james@herobots.com'
147+
email = 'james@wherobots.com'
150148
}
151149
}
152150

@@ -161,12 +159,36 @@ publishing {
161159

162160
repositories {
163161
maven {
164-
name = "WherobotsGithubPackages"
165-
url = "https://maven.pkg.github.com/wherobots/packages"
166-
credentials {
167-
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_USERNAME") || ""
168-
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
169-
}
162+
url = layout.buildDirectory.dir('staging-deploy')
170163
}
171164
}
172165
}
166+
167+
jreleaser {
168+
signing {
169+
active = 'ALWAYS'
170+
armored = true
171+
}
172+
deploy {
173+
maven {
174+
mavenCentral {
175+
'release-deploy' {
176+
active = 'RELEASE'
177+
url = 'https://central.sonatype.com/api/v1/publisher'
178+
stagingRepository('build/staging-deploy')
179+
}
180+
}
181+
nexus2 {
182+
'snapshot-deploy' {
183+
active = 'SNAPSHOT'
184+
snapshotUrl = 'https://central.sonatype.com/repository/maven-snapshots/'
185+
applyMavenCentralRules = true
186+
snapshotSupported = true
187+
closeRepository = true
188+
releaseRepository = true
189+
stagingRepository('build/staging-deploy')
190+
}
191+
}
192+
}
193+
}
194+
}

gradle/wrapper/gradle-wrapper.jar

-19.5 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)