Skip to content

Commit 929ff7e

Browse files
committed
Adding jreleaser for publishing
1 parent 979f594 commit 929ff7e

File tree

3 files changed

+54
-7
lines changed

3 files changed

+54
-7
lines changed

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish to Maven Central
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Set up JDK 17
13+
uses: actions/setup-java@v4
14+
with:
15+
java-version: '17'
16+
distribution: 'temurin'
17+
cache: gradle
18+
- name: Build with Gradle
19+
# This just publishes to the local file system; jreleaser is responsible for uploading to maven central
20+
run: gradlew publish
21+
- name: Upload to Maven Central
22+
env:
23+
# Needs to have access to the io.github.ArchipelagoMW namespace in maven central
24+
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.mavenCentralUsername }}
25+
JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.mavenCentralToken }}
26+
# The content uploaded to maven central needs to be signed. The public keys need to be published,
27+
# see https://central.sonatype.org/publish/requirements/gpg/#distributing-your-public-key for accepted
28+
# locations
29+
JRELEASER_GPG_PASSPHRASE: ${{ secrets.gpgPassphrase }}
30+
# The content here needs to be the values of the public and secret key pair
31+
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.gpgPublicKey }}
32+
JRELEASER_GPG_SECRET_KEY: ${{ secrets.gpgSecretKey }}
33+
run: gradlew jreleaserDeploy

build.gradle.kts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins {
77
}
88

99
group = "io.github.ArchipelagoMW"
10-
version = "0.1.20-SNAPSHOT"
10+
version = "0.1.20"
1111

1212
repositories {
1313
mavenCentral()
@@ -74,6 +74,9 @@ publishing {
7474
repositories {
7575
// For the time being
7676
mavenLocal()
77+
maven {
78+
url = uri(layout.buildDirectory.dir("staging-deploy"))
79+
}
7780
}
7881
pom {
7982
name = "Archipelago Java Library"
@@ -124,17 +127,27 @@ publishing {
124127
}
125128

126129
jreleaser {
130+
signing {
131+
active = Active.ALWAYS
132+
armored = true
133+
}
134+
release {
135+
github {
136+
enabled = true
137+
repoOwner = "ArchipelagoMW"
138+
overwrite = false
139+
skipRelease = true
140+
}
141+
}
127142
deploy {
128143
maven {
129144
mavenCentral {
130145
register("javaClient") {
131-
dryrun = true
132-
active = Active.RELEASE
146+
active = Active.ALWAYS
133147
applyMavenCentralRules = true
134-
sign = false
135-
stagingRepository("target/staging-deploy")
148+
url = "https://central.sonatype.com/api/v1/publisher"
149+
stagingRepository("build/staging-deploy")
136150
}
137-
138151
}
139152
}
140153
}

gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# This file was generated by the Gradle 'init' task.
22
# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
33

4-
org.gradle.configuration-cache=true
4+
# jreleaser breaks with this
5+
org.gradle.configuration-cache=false
56

0 commit comments

Comments
 (0)