Skip to content

Commit 74d49df

Browse files
committed
add publishing configuration
1 parent cdf2f8e commit 74d49df

File tree

7 files changed

+169
-4
lines changed

7 files changed

+169
-4
lines changed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "gradle"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"

.github/workflows/gradle.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
6+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
7+
8+
name: Java CI with Gradle
9+
10+
on: [push]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up JDK 21
20+
uses: actions/setup-java@v2
21+
with:
22+
java-version: '21'
23+
distribution: 'temurin'
24+
- name: Build with Gradle
25+
uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021
26+
with:
27+
arguments: build test

.github/workflows/publish_on_tag.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
6+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
7+
8+
name: Publish to mavencentral
9+
10+
on:
11+
push:
12+
tags:
13+
- '*'
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Set up JDK 21
22+
uses: actions/setup-java@v2
23+
with:
24+
java-version: '21'
25+
distribution: 'temurin'
26+
- name: Build and publish with Gradle
27+
uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021
28+
with:
29+
arguments: --no-daemon -i jreleaserConfig build test publish
30+
env:
31+
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
32+
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
33+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_SONATYPE_USERNAME }}
35+
JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.JRELEASER_MAVENCENTRAL_SONATYPE_TOKEN }}
36+
37+
- name: Release with gradle
38+
uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021
39+
with:
40+
arguments: --no-daemon -i jreleaserFullRelease
41+
env:
42+
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
43+
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
44+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_SONATYPE_USERNAME }}
46+
JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.JRELEASER_MAVENCENTRAL_SONATYPE_TOKEN }}

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# dlt-core
2+
3+
dlt-core is a kotlin library to parse autosar dlt files.
4+
5+
It currently only supports dlt version 1.
6+
7+
Usage:
8+
```kotlin
9+
DltMessageParser.parseFile(Path.of("file.dlt")).forEach {
10+
val msg = it.dltMessage as DltMessageV1
11+
if (msg.extendedHeader?.apIdText != "MYAP") {
12+
return@forEach
13+
}
14+
// do stuff with msg
15+
}
16+
```

build.gradle.kts

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2+
import org.jreleaser.model.Active
3+
import org.jreleaser.model.Http
4+
15
plugins {
26
kotlin("jvm").version("2.0.0")
37
`java-library`
4-
signing
58
`maven-publish`
9+
id("org.jreleaser") version "1.12.0"
610
}
711

812
group = "io.github.froks"
@@ -21,8 +25,11 @@ tasks.test {
2125
}
2226

2327
kotlin {
24-
jvmToolchain(17)
28+
jvmToolchain(21)
2529
explicitApi()
30+
compilerOptions {
31+
jvmTarget = JvmTarget.JVM_1_8
32+
}
2633
}
2734

2835
java {
@@ -36,6 +43,64 @@ tasks.withType<JavaCompile>().configureEach {
3643
}
3744

3845
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
39-
kotlinOptions.jvmTarget = "1.8"
40-
kotlinOptions.freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
46+
compilerOptions {
47+
jvmTarget.set(JvmTarget.JVM_1_8)
48+
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
49+
}
50+
}
51+
52+
publishing {
53+
publications {
54+
create<MavenPublication>("mavenJava") {
55+
from(components["java"])
56+
pom {
57+
name.set("dlt-core")
58+
description.set("Kotlin based parser library for autosar dlt files")
59+
url.set("https://github.com/froks/dlt-core")
60+
developers {
61+
developer {
62+
id.set("froks")
63+
name.set("Florian Roks")
64+
email.set("flo.github@debugco.de")
65+
}
66+
}
67+
scm {
68+
url.set("https://github.com/froks/dlt-core")
69+
developerConnection.set("scm:git:ssh://github.com:froks/dlt-core.git")
70+
connection.set("scm:git:git://github.com/froks/dlt-core.git")
71+
}
72+
licenses {
73+
license {
74+
name.set("The Apache License, Version 2.0")
75+
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
76+
}
77+
}
78+
}
79+
}
80+
}
81+
82+
repositories {
83+
maven {
84+
setUrl(layout.buildDirectory.dir("staging-deploy"))
85+
}
86+
}
87+
}
88+
89+
jreleaser {
90+
signing {
91+
active = Active.ALWAYS
92+
armored = true
93+
verify = false
94+
}
95+
deploy {
96+
maven {
97+
mavenCentral.create("sonatype") {
98+
active = Active.ALWAYS
99+
username = System.getenv("JRELEASER_MAVENCENTRAL_USERNAME")
100+
url = "https://central.sonatype.com/api/v1/publisher"
101+
authorization = Http.Authorization.BEARER
102+
stagingRepository(layout.buildDirectory.dir("staging-deploy").get().toString())
103+
}
104+
}
105+
}
41106
}

gradlew

100644100755
File mode changed.

gradlew.bat

100644100755
File mode changed.

0 commit comments

Comments
 (0)