Skip to content

Commit 324a11a

Browse files
feat: Add setting to disable git-signing (#72)
1 parent f3fff60 commit 324a11a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/main/kotlin/git/semver/plugin/scm/GitProvider.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,17 @@ internal class GitProvider(private val settings: SemverSettings) {
7676
val isCommit = isFormatEnabled(params.commit, settings.releaseCommitTextFormat)
7777
if (isCommit) {
7878
val commitMessage = settings.releaseCommitTextFormat.format(versionString, params.message.orEmpty())
79-
it.commit().setMessage(commitMessage.trim()).call()
79+
val commitCommand = it.commit().setMessage(commitMessage.trim())
80+
settings.gitSigning?.let(commitCommand::setSign) // Set signing if not set to null
81+
commitCommand.call()
8082
}
8183

8284
val isTag = isFormatEnabled(params.tag, settings.releaseTagNameFormat)
8385
if (isTag) {
8486
val name = settings.releaseTagNameFormat.format(versionString)
85-
it.tag().setName(name).setMessage(params.message).call()
87+
val tagCommand = it.tag().setName(name).setMessage(params.message)
88+
settings.gitSigning?.let(tagCommand::setSigned) // Set signing if not set to null
89+
tagCommand.call()
8690
println("Created new local Git tag: $name")
8791
}
8892

src/main/kotlin/git/semver/plugin/semver/BaseSettings.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ abstract class BaseSettings(
1212
var releaseTagNameFormat: String = "%s",
1313
var groupVersionIncrements: Boolean = true,
1414
var noDirtyCheck: Boolean = false,
15-
var noAutoBump: Boolean = false
15+
var noAutoBump: Boolean = false,
16+
var gitSigning: Boolean? = null // null means use the jgit default
1617
) : Serializable {
1718
constructor(settings: BaseSettings) : this(
1819
settings.defaultPreRelease, settings.releasePattern, settings.patchPattern, settings.minorPattern,

0 commit comments

Comments
 (0)