Skip to content

Commit e0ca12b

Browse files
committed
ci: configure snapshot release
1 parent a55005f commit e0ca12b

File tree

3 files changed

+96
-48
lines changed

3 files changed

+96
-48
lines changed

RELEASING.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ This document explains how to create releases for the extra-ktor-plugins project
55
## Quick Start - How to Release
66

77
### 🔄 Automatic Snapshots
8-
**No action needed!** Snapshots are created automatically:
8+
**No action needed!** Snapshots are built and staged locally:
99
- Push commits to `main` branch
1010
- Wait for `build-main.yml` to succeed
1111
- `release.yml` automatically triggers and creates a snapshot (e.g., `2.3.0-SNAPSHOT`)
12-
- Artifacts published to Maven Central staging repository
12+
- Artifacts are staged locally but **not published to Maven Central**
1313

1414
### 🚀 Production Release
1515
1. Go to **Actions** tab in GitHub
@@ -26,6 +26,16 @@ This document explains how to create releases for the extra-ktor-plugins project
2626
### 📦 Manual Snapshot (Optional)
2727
Same as production release, but select **"snapshot"** from the dropdown.
2828

29+
### Snapshot vs Release Details
30+
31+
The `release.yml` workflow decides whether to perform a snapshot or a release based on the type of trigger and the `release.mode` property:
32+
33+
- **Automatic triggers** (e.g., after successful `build-main.yml`) default to `release.mode=snapshot`, producing snapshot versions.
34+
- **Manual triggers** allow selection between `snapshot` and `release` modes.
35+
- The `release.mode` property controls version suffixes and deployment behavior:
36+
- `snapshot` mode appends `-SNAPSHOT` and stages artifacts locally without publishing to Maven Central.
37+
- `release` mode produces clean versions and publishes artifacts to Maven Central with GitHub release creation.
38+
2939
---
3040

3141
## How It Works
@@ -101,6 +111,7 @@ snapshotCreator { version, position ->
101111
- Publishes to Maven Central staging repository
102112
- No GitHub release created
103113
- No tags created
114+
- Snapshots are released to ossrh repository (maven central doesn't support snapshots)
104115

105116
**Release Mode (`jreleaserFullRelease`):**
106117
- Publishes to Maven Central (production)
@@ -109,6 +120,19 @@ snapshotCreator { version, position ->
109120

110121
**Configuration:** Located in `build.gradle.kts` under `jreleaser` block
111122

123+
##### Snapshot Publishing (optional)
124+
125+
To enable snapshot publishing with JReleaser, you can add a snapshot deployer in Gradle configuration:
126+
127+
```kotlin
128+
jreleaser {
129+
snapshot {
130+
active = org.jreleaser.model.Active.SNAPSHOT
131+
// configure snapshot deployer details here
132+
}
133+
}
134+
```
135+
112136
#### 4. **Build Main Workflow** (`.github/workflows/build-main.yml`)
113137
**Role:** Quality gate for automatic snapshots
114138

@@ -155,7 +179,7 @@ snapshotCreator { version, position ->
155179
156180
### Conventional Commits Integration
157181
158-
The system relies on conventional commit messages for version calculation:
182+
The system relies on conventional commit messages for version calculation and now includes merge commits in the changelog generation using the settings `skipMergeCommits=false` and `includeUncategorized=true`. Non-conventional commit subjects such as merge commits will appear under the "Uncategorized" section of the changelog, while CI-related commits are filtered out to keep the changelog relevant and clean.
159183
160184
| Commit Type | Version Impact | Example |
161185
|-------------|----------------|---------|

build.gradle.kts

Lines changed: 67 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent.SKIPPED
1212
import org.gradle.api.tasks.testing.logging.TestLogging
1313
import org.gradle.api.tasks.testing.logging.TestStackTraceFilter
1414
import org.jreleaser.gradle.plugin.dsl.deploy.maven.MavenCentralMavenDeployer
15+
import org.jreleaser.gradle.plugin.dsl.deploy.maven.Nexus2MavenDeployer
16+
import org.jreleaser.model.Active.ALWAYS
17+
import org.jreleaser.model.Active.RELEASE
18+
import org.jreleaser.model.Active.SNAPSHOT
1519
import ru.vyarus.gradle.plugin.python.PythonExtension
1620
import java.time.Instant.ofEpochSecond
1721

@@ -163,10 +167,12 @@ scmVersion {
163167
hasMajor = true
164168
logger.quiet("[VersionIncrementer] → Triggers MAJOR version bump (breaking change)")
165169
}
170+
166171
type == "feat" -> {
167172
hasMinor = true
168173
logger.quiet("[VersionIncrementer] → Triggers MINOR version bump (new feature)")
169174
}
175+
170176
type in
171177
setOf(
172178
"fix",
@@ -244,61 +250,78 @@ allprojects {
244250
version = rootProject.version
245251
}
246252

253+
// see: https://jreleaser.org/guide/latest/examples/maven/maven-central.html#_portal_publisher_api
247254
jreleaser {
248255
// Configure the project
249256
project {
250-
name.set("${rootProject.name}: ${project.name}")
251-
description.set(
252-
"This project provides a suite of feature-rich, efficient, and highly customizable plugins for your Ktor Server or Client, crafted in Kotlin, available for multiplatform.",
253-
)
254-
longDescription.set(
255-
"A comprehensive collection of Ktor plugins including rate limiting, Kafka integration, circuit breaker patterns, and distributed task scheduling. Built with Kotlin Multiplatform support for JVM, Native, and JS platforms.",
256-
)
257-
authors.add("Ido Flax")
258-
license.set("Apache-2.0")
259-
copyright.set("Copyright (c) 2023 Ido Flax")
257+
name = "${rootProject.name}: ${project.name}"
258+
description =
259+
"This project provides a suite of feature-rich, efficient, and highly customizable plugins for your Ktor Server or Client, crafted in Kotlin, available for multiplatform."
260+
261+
longDescription =
262+
"A comprehensive collection of Ktor plugins including rate limiting, Kafka integration, circuit breaker patterns, and distributed task scheduling. Built with Kotlin Multiplatform support for JVM, Native, and JS platforms."
263+
264+
license = "Apache-2.0"
265+
copyright = "Copyright (c) 2023 Ido Flax"
260266
authors.add("Ido Flax")
261267
maintainers.add("Ido Flax")
262268
links {
263-
homepage.set("https://github.com/Flaxoos/extra-ktor-plugins")
264-
documentation.set("https://flaxoos.github.io/extra-ktor-plugins/")
265-
license.set("https://opensource.org/license/apache-2-0")
266-
donation.set("https://github.com/sponsors/Flaxoos")
267-
contact.set("Kotlin Slack - Ido Flax. [email protected]")
269+
homepage = "https://github.com/Flaxoos/extra-ktor-plugins"
270+
documentation = "https://flaxoos.github.io/extra-ktor-plugins/"
271+
license = "https://opensource.org/license/apache-2-0"
272+
donation = "https://github.com/sponsors/Flaxoos"
273+
contact = "Kotlin Slack - Ido Flax. [email protected]"
268274
}
269-
inceptionYear.set("2023")
275+
inceptionYear = "2023"
270276
}
271277
// Sign the release
272278
signing {
273-
active.set(org.jreleaser.model.Active.ALWAYS)
274-
armored.set(true)
275-
publicKey.set(jreleaserGpgPublicKey)
276-
secretKey.set(jreleaserGpgSecretKey)
277-
passphrase.set(jreleaserGpgPassphrase)
279+
active = ALWAYS
280+
armored = true
281+
publicKey = jreleaserGpgPublicKey
282+
secretKey = jreleaserGpgSecretKey
283+
passphrase = jreleaserGpgPassphrase
278284
}
279-
// Deploy to Maven Central
280285
deploy {
286+
val stagingDir =
287+
layout.buildDirectory
288+
.dir("staging-deploy")
289+
.get()
290+
.asFile
291+
if (!stagingDir.exists()) stagingDir.mkdirs()
281292
maven {
282293
mavenCentral {
283294
create(
284-
"flaxoos-extra-ktor-plugins",
295+
"release-deploy",
285296
closureOf<MavenCentralMavenDeployer> {
286-
active.set(org.jreleaser.model.Active.ALWAYS)
287-
url.set("https://central.sonatype.com/api/v1/publisher")
288-
stagingRepository(
289-
layout.buildDirectory
290-
.dir("staging-deploy")
291-
.get()
292-
.asFile.absolutePath,
293-
)
297+
active = RELEASE
298+
url = "https://central.sonatype.com/api/v1/publisher"
299+
stagingRepository(stagingDir.absolutePath)
294300

295-
username.set(mcUsername)
296-
password.set(mcPassword)
301+
username = mcUsername
302+
password = mcPassword
297303

298-
connectTimeout.set(20)
299-
readTimeout.set(60)
300-
retryDelay.set(5)
301-
maxRetries.set(3)
304+
connectTimeout = 20
305+
readTimeout = 60
306+
retryDelay = 5
307+
maxRetries = 3
308+
},
309+
)
310+
}
311+
nexus2 {
312+
create(
313+
"snapshot-deploy",
314+
closureOf<Nexus2MavenDeployer> {
315+
active = SNAPSHOT
316+
snapshotUrl = "https://central.sonatype.com/repository/maven-snapshots/"
317+
applyMavenCentralRules = true
318+
snapshotSupported = true
319+
closeRepository = true
320+
releaseRepository = true
321+
stagingRepository(stagingDir.absolutePath)
322+
323+
username = mcUsername
324+
password = mcPassword
302325
},
303326
)
304327
}
@@ -307,14 +330,14 @@ jreleaser {
307330
// Create a release in GitHub
308331
release {
309332
github {
310-
enabled.set(true)
311-
repoOwner.set("Flaxoos")
312-
name.set("extra-ktor-plugins")
313-
tagName.set("v{{projectVersion}}")
314-
releaseName.set("v{{projectVersion}}")
315-
overwrite.set(true)
333+
enabled = true
334+
repoOwner = "Flaxoos"
335+
name = "extra-ktor-plugins"
336+
tagName = "v{{projectVersion}}"
337+
releaseName = "v{{projectVersion}}"
338+
overwrite = true
316339
update {
317-
enabled.set(true)
340+
enabled = true
318341
}
319342
changelog {
320343
enabled.set(true)

buildSrc/src/main/kotlin/io/github/flaxoos/ktor/extensions/Credentials.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ val Project.gprUser: String by ProjectPropertyDelegate.projectOrSystemEnv()
1717

1818
val Project.mcUsername: String by ProjectPropertyDelegate.projectOrSystemEnv()
1919
val Project.mcPassword: String by ProjectPropertyDelegate.projectOrSystemEnv()
20-
20+
val Project.ossrhUsername: String by ProjectPropertyDelegate.projectOrSystemEnv()
21+
val Project.ossrhPassword: String by ProjectPropertyDelegate.projectOrSystemEnv()
2122
val Project.jreleaserGpgPublicKey: String by ProjectPropertyDelegate.projectOrSystemEnv()
2223
val Project.jreleaserGpgSecretKey: String by ProjectPropertyDelegate.projectOrSystemEnv()
2324
val Project.jreleaserGpgPassphrase: String by ProjectPropertyDelegate.projectOrSystemEnv()

0 commit comments

Comments
 (0)