From 45e91d00f7dd06b62ba2872cf0116c16d3b29988 Mon Sep 17 00:00:00 2001 From: Florian Roks Date: Sun, 16 Jun 2024 10:10:46 +0200 Subject: [PATCH] add publishing configuration --- .github/dependabot.yml | 11 +++++ .github/workflows/gradle.yml | 27 ++++++++++++ .github/workflows/publish_on_tag.yml | 36 ++++++++++++++++ README.md | 16 +++++++ build.gradle.kts | 64 ++++++++++++++++++++++++++-- 5 files changed, 150 insertions(+), 4 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/gradle.yml create mode 100644 .github/workflows/publish_on_tag.yml create mode 100644 README.md diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..bc03f42 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "gradle" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000..41b67bf --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,27 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Java CI with Gradle + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 21 + uses: actions/setup-java@v2 + with: + java-version: '21' + distribution: 'temurin' + - name: Build with Gradle + uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021 + with: + arguments: build test diff --git a/.github/workflows/publish_on_tag.yml b/.github/workflows/publish_on_tag.yml new file mode 100644 index 0000000..da9eb1f --- /dev/null +++ b/.github/workflows/publish_on_tag.yml @@ -0,0 +1,36 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Publish to mavencentral + +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 21 + uses: actions/setup-java@v2 + with: + java-version: '21' + distribution: 'temurin' + - name: Build and publish with Gradle + uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021 + with: + arguments: jreleaserConfig build test publish jreleaserFullRelease + env: + JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }} + JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }} + JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + JRELEASER_MAVENCENTRAL_SONATYPE_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_SONATYPE_USERNAME }} + JRELEASER_MAVENCENTRAL_SONATYPE_TOKEN: ${{ secrets.JRELEASER_MAVENCENTRAL_SONATYPE_TOKEN }} + diff --git a/README.md b/README.md new file mode 100644 index 0000000..f9e34aa --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# dlt-core + +dlt-core is a kotlin library to parse autosar dlt files. + +It currently only supports dlt version 1. + +Usage: +```kotlin +DltMessageParser.parseFile(Path.of("file.dlt")).forEach { + val msg = it.dltMessage as DltMessageV1 + if (msg.extendedHeader?.apIdText != "MYAP") { + return@forEach + } + // do stuff with msg +} +``` diff --git a/build.gradle.kts b/build.gradle.kts index e612f61..a186ae5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,8 +1,11 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jreleaser.model.Active + plugins { kotlin("jvm").version("2.0.0") `java-library` - signing `maven-publish` + id("org.jreleaser") version "1.12.0" } group = "io.github.froks" @@ -21,8 +24,11 @@ tasks.test { } kotlin { - jvmToolchain(17) + jvmToolchain(21) explicitApi() + compilerOptions { + jvmTarget = JvmTarget.JVM_1_8 + } } java { @@ -36,6 +42,56 @@ tasks.withType().configureEach { } tasks.withType().configureEach { - kotlinOptions.jvmTarget = "1.8" - kotlinOptions.freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn" + compilerOptions { + jvmTarget.set(JvmTarget.JVM_1_8) + freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn") + } +} + +publishing { + publications { + create("mavenJava") { + from(components["java"]) + pom { + name.set("dlt-core") + description.set("Kotlin based parser library for autosar dlt files") + url.set("https://github.com/froks/dlt-core") + developers { + developer { + id.set("froks") + name.set("Florian Roks") + email.set("flo.github@debugco.de") + } + } + scm { + url.set("https://github.com/froks/dlt-core") + developerConnection.set("scm:git:ssh://github.com:froks/dlt-core.git") + connection.set("scm:git:git://github.com/froks/dlt-core.git") + } + licenses { + license { + name.set("The Apache License, Version 2.0") + url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") + } + } + } + } + } +} + +jreleaser { + signing { + active = Active.ALWAYS + armored = true + verify = false + } + deploy { + maven { + mavenCentral.create("sonatype") { + active = Active.ALWAYS + url = "https://central.sonatype.com/api/v1/publisher" + stagingRepository("target/staging-deploy") + } + } + } }