Skip to content

Commit 7c65fde

Browse files
authored
feat: Maven Central release pipeline (KOJAK-35) (#18)
## Summary - Add vanniktech/gradle-maven-publish-plugin v0.36.0 via buildSrc convention plugin - Publish all 7 modules (core, postgres, mysql, http, kafka, spring-boot, bom) with unified versioning - Tag-triggered `publish` job in ci.yml → Sonatype Central Portal - Release-drafter for automatic GitHub Release notes (draft on push, publish on tag) ## Pre-release checklist (before tagging v0.1.0) - [ ] Verify with Adam: do org-level SONATYPE secrets work with Central Portal API (vanniktech)? - [ ] Verify namespace `com.softwaremill` covers `com.softwaremill.okapi` in Central Portal - [ ] Run `./gradlew publishToMavenLocal` to verify JARs and POM structure - [ ] Optionally tag `v0.1.0-RC1` to test the full CI pipeline ## Test plan - [x] `./gradlew build` — BUILD SUCCESSFUL - [x] `./gradlew ktlintCheck` — PASS - [x] Publishing tasks registered (`publishAndReleaseToMavenCentral`) - [ ] CI passes on this PR - [ ] Tag-triggered publish verified (post-merge, via RC tag)
1 parent 74034b2 commit 7c65fde

13 files changed

Lines changed: 116 additions & 0 deletions

File tree

.github/release-drafter.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
template: |
2+
## What's Changed
3+
4+
$CHANGES

.github/workflows/ci.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
branches: [ main ]
55
push:
66
branches: [ main ]
7+
tags: [ v* ]
78

89
permissions:
910
contents: write # auto-merge requirement
@@ -43,6 +44,14 @@ jobs:
4344
name: test-results-java-${{ matrix.java }}
4445
path: '**/build/test-results/test/TEST-*.xml'
4546

47+
- name: Prepare release notes
48+
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')
49+
uses: release-drafter/release-drafter@v7
50+
with:
51+
config-name: release-drafter.yml
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
4655
spring-compat:
4756
name: "Spring Boot ${{ matrix.spring-boot }}"
4857
runs-on: ubuntu-24.04
@@ -86,6 +95,48 @@ jobs:
8695
- name: Test okapi-kafka
8796
run: ./gradlew :okapi-kafka:test -PkafkaVersion=${{ matrix.kafka }}
8897

98+
publish:
99+
name: Publish to Maven Central
100+
needs: [build, spring-compat, kafka-compat]
101+
runs-on: ubuntu-24.04
102+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))
103+
steps:
104+
- name: Checkout
105+
uses: actions/checkout@v6
106+
107+
- name: Set up JDK 21
108+
uses: actions/setup-java@v5
109+
with:
110+
distribution: 'temurin'
111+
java-version: 21
112+
113+
- name: Setup Gradle
114+
uses: gradle/actions/setup-gradle@39e147cb9de83bb9910b8ef8bd7fff0ee20fcd6f # v6.0.1
115+
116+
- name: Publish to Maven Central
117+
run: ./gradlew publishAndReleaseToMavenCentral
118+
env:
119+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
120+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
121+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.PGP_SECRET }}
122+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.PGP_PASSPHRASE }}
123+
124+
- name: Extract version from tag
125+
run: |
126+
version=${GITHUB_REF/refs\/tags\/v/}
127+
echo "VERSION=$version" >> $GITHUB_ENV
128+
129+
- name: Publish release notes
130+
uses: release-drafter/release-drafter@v7
131+
with:
132+
config-name: release-drafter.yml
133+
publish: true
134+
name: "v${{ env.VERSION }}"
135+
tag: "v${{ env.VERSION }}"
136+
version: "v${{ env.VERSION }}"
137+
env:
138+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139+
89140
auto-merge-dependabot:
90141
# only for PRs by dependabot[bot]
91142
if: github.event.pull_request.user.login == 'dependabot[bot]'

buildSrc/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ kotlin {
99
dependencies {
1010
implementation(libs.kotlinGradlePlugin)
1111
implementation(libs.ktlintGradlePlugin)
12+
implementation(libs.vanniktechPublishPlugin)
1213
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package buildsrc.convention
2+
3+
plugins {
4+
id("com.vanniktech.maven.publish")
5+
}
6+
7+
mavenPublishing {
8+
publishToMavenCentral()
9+
signAllPublications()
10+
11+
pom {
12+
name.set(project.name)
13+
description.set(provider { project.description ?: "Transactional outbox pattern for Kotlin/JVM" })
14+
url.set("https://github.com/softwaremill/okapi")
15+
licenses {
16+
license {
17+
name.set("Apache-2.0")
18+
url.set("https://www.apache.org/licenses/LICENSE-2.0")
19+
}
20+
}
21+
developers {
22+
developer {
23+
id.set("softwaremill")
24+
name.set("SoftwareMill")
25+
url.set("https://softwaremill.com")
26+
}
27+
}
28+
scm {
29+
connection.set("scm:git:git://github.com/softwaremill/okapi.git")
30+
developerConnection.set("scm:git:ssh://github.com/softwaremill/okapi.git")
31+
url.set("https://github.com/softwaremill/okapi")
32+
}
33+
}
34+
}

gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ org.gradle.caching=true
55
# (Note that some plugins may not yet be compatible with the configuration cache.)
66
# https://docs.gradle.org/current/userguide/configuration_cache.html
77
org.gradle.configuration-cache=true
8+
9+
GROUP=com.softwaremill.okapi
10+
VERSION_NAME=0.1.0

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ mysql = "9.6.0"
1111
kafkaClients = "4.2.0"
1212
spring = "7.0.6"
1313
springBoot = "4.0.5"
14+
vanniktechPublish = "0.36.0"
1415
wiremock = "3.13.2"
1516
slf4j = "2.0.17"
1617
assertj = "3.27.7"
1718

1819
[libraries]
1920
kotlinGradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
2021
ktlintGradlePlugin = { module = "org.jlleitschuh.gradle:ktlint-gradle", version.ref = "ktlint" }
22+
vanniktechPublishPlugin = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "vanniktechPublish" }
2123
kotestRunnerJunit5 = { module = "io.kotest:kotest-runner-junit5", version.ref = "kotest" }
2224
kotestAssertionsCore = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest" }
2325
exposedCore = { module = "org.jetbrains.exposed:exposed-core", version.ref = "exposed" }

okapi-bom/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
plugins {
22
`java-platform`
3+
id("buildsrc.convention.publish")
34
}
45

6+
description = "BOM for consistent versioning of Okapi modules"
7+
58
dependencies {
69
constraints {
710
api(project(":okapi-core"))

okapi-core/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
plugins {
22
id("buildsrc.convention.kotlin-jvm")
3+
id("buildsrc.convention.publish")
34
}
45

6+
description = "Core outbox abstractions and processing engine"
7+
58
dependencies {
69
implementation(libs.slf4jApi)
710
testImplementation(libs.kotestRunnerJunit5)

okapi-http/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
plugins {
22
id("buildsrc.convention.kotlin-jvm")
3+
id("buildsrc.convention.publish")
34
}
45

6+
description = "HTTP message delivery for outbox entries"
7+
58
dependencies {
69
implementation(project(":okapi-core"))
710
implementation(libs.jacksonModuleKotlin)

okapi-kafka/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
plugins {
22
id("buildsrc.convention.kotlin-jvm")
3+
id("buildsrc.convention.publish")
34
}
45

6+
description = "Apache Kafka message delivery"
7+
58
dependencies {
69
implementation(project(":okapi-core"))
710
implementation(libs.jacksonModuleKotlin)

0 commit comments

Comments
 (0)