Skip to content

Commit 6ca4f82

Browse files
committed
feat: add LSD Kotlin conventions plugins
- Add lsd.library plugin for Java library conventions - Add lsd.kotlin-library plugin extending lsd.library with Kotlin features - Include Dokka documentation and JaCoCo test coverage - Configure Maven Central publishing with signing
1 parent ed8de70 commit 6ca4f82

File tree

6 files changed

+147
-1
lines changed

6 files changed

+147
-1
lines changed

.github/dependabot.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gradle"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
commit-message:
8+
prefix: "fix"
9+
groups:
10+
runtime-dependencies:
11+
patterns:
12+
- "org.jetbrains.kotlin:kotlin-gradle-plugin:*"
13+
- "org.jetbrains.dokka:dokka-gradle-plugin:*"
14+
- "io.github.gradle-nexus:publish-plugin:*"
15+
- "com.palantir.gradle.gitversion:gradle-git-version:*"
16+
- "org.springframework.boot:spring-boot-gradle-plugin:*"
17+
- "io.spring.gradle:dependency-management-plugin:*"
18+
- "org.jetbrains.kotlin:kotlin-allopen:*"

.github/workflows/ci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# This workflow will build a Gradle project then perform an automated release
2+
# For more information see:
3+
# https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
4+
# https://github.com/marketplace/actions/action-for-semantic-release
5+
6+
name: CI
7+
on:
8+
push:
9+
branches:
10+
- main
11+
pull_request:
12+
branches:
13+
- main
14+
jobs:
15+
build:
16+
uses: lsd-consulting/shared-workflows/.github/workflows/build.yml@main
17+
with:
18+
java-version: '17'
19+
codecov: true
20+
secrets: inherit
21+
release:
22+
needs: build
23+
uses: lsd-consulting/shared-workflows/.github/workflows/release.yml@main
24+
with:
25+
java-version: '17'
26+
secrets: inherit
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Merge dependabot PR
2+
on:
3+
pull_request_target:
4+
branches:
5+
- main
6+
jobs:
7+
pr-merge:
8+
uses: lsd-consulting/shared-workflows/.github/workflows/dependabot-merge.yml@main
9+
secrets: inherit

.github/workflows/nightly.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: Nightly Build
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: '0 2 * * *' # run at 2 AM UTC
6+
jobs:
7+
build:
8+
uses: lsd-consulting/shared-workflows/.github/workflows/build.yml@main
9+
with:
10+
java-version: '17'

.releaserc.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# See:
2+
# https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#configuration
3+
# https://github.com/marketplace/actions/action-for-semantic-release
4+
5+
branches: ["master", "main"]
6+
plugins:
7+
- "@semantic-release/commit-analyzer"
8+
- "@semantic-release/release-notes-generator"
9+
- "@semantic-release/github"

build.gradle.kts

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
plugins {
22
`kotlin-dsl`
33
`maven-publish`
4+
signing
5+
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
6+
id("com.palantir.git-version") version "4.0.0"
47
}
58

69
group = "io.github.lsd-consulting"
7-
version = "1.0.0"
10+
val gitVersion: groovy.lang.Closure<String> by extra
11+
version = gitVersion().replace(Regex("^v"), "")
12+
13+
logger.lifecycle("Version: $version")
814

915
java {
1016
sourceCompatibility = JavaVersion.VERSION_17
@@ -42,3 +48,71 @@ gradlePlugin {
4248
}
4349
}
4450
}
51+
52+
publishing {
53+
publications {
54+
withType<MavenPublication> {
55+
pom {
56+
name.set("LSD Kotlin Conventions")
57+
description.set("Gradle convention plugins for LSD projects.")
58+
url.set("https://github.com/lsd-consulting/lsd-kotlin-conventions")
59+
60+
licenses {
61+
license {
62+
name.set("MIT License")
63+
url.set("https://github.com/lsd-consulting/lsd-kotlin-conventions/blob/main/LICENSE")
64+
}
65+
}
66+
67+
developers {
68+
developer {
69+
id.set("nickmcdowall")
70+
name.set("Nick")
71+
email.set("nicholas.mcdowall@gmail.com")
72+
}
73+
developer {
74+
id.set("lukaszgryzbon")
75+
name.set("Lukasz")
76+
email.set("lukasz.gryzbon@gmail.com")
77+
}
78+
}
79+
80+
scm {
81+
connection.set("scm:git:git@github.com:lsd-consulting/lsd-kotlin-conventions.git")
82+
developerConnection.set("scm:git:git@github.com:lsd-consulting/lsd-kotlin-conventions.git")
83+
url.set("https://github.com/lsd-consulting/lsd-kotlin-conventions")
84+
}
85+
}
86+
}
87+
}
88+
89+
repositories {
90+
maven {
91+
name = "ossrh-staging-api"
92+
url = uri("https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/")
93+
credentials(PasswordCredentials::class)
94+
}
95+
}
96+
}
97+
98+
signing {
99+
if (project.findProperty("signingKey") != null) {
100+
// Use in-memory ascii-armored keys
101+
val signingKey: String? = findProperty("signingKey") as String?
102+
val signingPassword: String? = findProperty("signingPassword") as String?
103+
useInMemoryPgpKeys(signingKey, signingPassword)
104+
sign(publishing.publications)
105+
} else {
106+
// Use signing properties in ~/.gradle/gradle.properties
107+
sign(publishing.publications)
108+
}
109+
}
110+
111+
nexusPublishing {
112+
repositories {
113+
sonatype {
114+
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
115+
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
116+
}
117+
}
118+
}

0 commit comments

Comments
 (0)