-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Geert Mulders <[email protected]>
- Loading branch information
Showing
4 changed files
with
106 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Publish Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '**' | ||
|
||
jobs: | ||
publish: | ||
|
||
runs-on: ubuntu-latest | ||
if: github.repository == 'alliander-opensource/measure' | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: zulu | ||
java-version: 17 | ||
|
||
- name: Get release notes | ||
run: | | ||
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV | ||
echo "$(awk '/^## ${{ github.ref_name }}/{flag=1;next}/^## /{flag=0}flag' CHANGELOG.md)" >> $GITHUB_ENV | ||
echo "EOF" >> $GITHUB_ENV | ||
- name: Set version for tag | ||
run: | | ||
echo "ORG_GRADLE_PROJECT_VERSION_NAME=${{ github.ref_name }}" >> $GITHUB_ENV | ||
- uses: gradle/actions/setup-gradle@v4 | ||
|
||
- name: Publish | ||
run: ./gradlew :measure:publishToMavenCentral | ||
env: | ||
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | ||
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | ||
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_PRIVATE_KEY }} | ||
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_PASSPHRASE }} | ||
|
||
# - name: Create Release | ||
# uses: softprops/action-gh-release@v2 | ||
# with: | ||
# token: ${{ secrets.GITHUB_TOKEN }} | ||
# body: ${{ env.RELEASE_NOTES }} | ||
# if: ${{ env.RELEASE_NOTES != '' }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Change Log | ||
|
||
## 1.3.0 *(2024-12-15)* | ||
|
||
- First open source release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,18 +2,20 @@ | |
// | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
import com.vanniktech.maven.publish.SonatypeHost | ||
import org.jetbrains.dokka.gradle.DokkaTask | ||
|
||
plugins { | ||
// Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin. | ||
id("org.jetbrains.kotlin.jvm") | ||
kotlin("jvm") | ||
|
||
// Apply the java-library plugin for API and implementation separation. | ||
`java-library` | ||
|
||
// Apply dokka plugin to allow extraction of ducumentation from KDoc comments | ||
id("org.jetbrains.dokka") version "1.4.20" | ||
|
||
// Make sure we can publish to maven | ||
`maven-publish` | ||
id("com.vanniktech.maven.publish") version "0.30.0" | ||
} | ||
|
||
group = "com.alliander" | ||
|
@@ -30,47 +32,65 @@ dependencies { | |
// Use the Kotlin JDK 8 standard library. | ||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") | ||
|
||
testImplementation("io.kotest:kotest-runner-junit5:4.3.2") | ||
testImplementation("io.kotest:kotest-assertions-core:4.3.2") | ||
testImplementation("io.kotest:kotest-property:4.3.2") | ||
testImplementation("io.kotest:kotest-runner-junit5:5.9.1") | ||
testImplementation("io.kotest:kotest-assertions-core:5.9.1") | ||
testImplementation("io.kotest:kotest-property:5.9.1") | ||
} | ||
|
||
kotlin { | ||
jvmToolchain(17) | ||
} | ||
|
||
java { | ||
toolchain { | ||
languageVersion.set(JavaLanguageVersion.of("17")) | ||
} | ||
// We add both the sources and the javadoc jar. | ||
withSourcesJar() | ||
withJavadocJar() | ||
} | ||
|
||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach { | ||
kotlinOptions { | ||
jvmTarget = "17" | ||
} | ||
// This task is added by Gradle when we use java.withJavadocJar() | ||
val javadocJar = tasks.named<Jar>("javadocJar") { | ||
from(tasks.named("dokkaJavadoc")) | ||
} | ||
|
||
tasks.withType<Test> { | ||
useJUnitPlatform() | ||
} | ||
|
||
tasks.withType<org.jetbrains.dokka.gradle.DokkaTask>().configureEach { | ||
tasks.withType<DokkaTask>().configureEach { | ||
outputDirectory.set(buildDir.resolve("dokka")) | ||
} | ||
|
||
publishing { | ||
publications { | ||
create<MavenPublication>("maven") { | ||
artifactId = "open.measure" | ||
from(components["kotlin"]) | ||
} | ||
} | ||
mavenPublishing { | ||
// Publishing to https://s01.oss.sonatype.org | ||
publishToMavenCentral(SonatypeHost.S01) | ||
signAllPublications() | ||
coordinates("com.alliander", "measure", "1.3.0-SNAPSHOT") | ||
|
||
pom { | ||
name.set("Measure") | ||
description.set("Measure is a Kotlin library for working with units of measurement that are - for example - used in the power system sector.") | ||
url.set("https://github.com/alliander-opensource/measure") | ||
|
||
repositories { | ||
maven { | ||
name = "AllianderNexus" | ||
url = uri("https://nexus.apps.ocp-01.prd.ahcaws.com/repository/maven-releases/") | ||
credentials { | ||
username = System.getenv("ALLIANDER_NEXUS_USERNAME") | ||
password = System.getenv("ALLIANDER_NEXUS_PASSWORD") | ||
licenses { | ||
license { | ||
name.set("Mozilla Public License Version 2.0") | ||
url.set("https://www.mozilla.org/en-US/MPL/2.0/") | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("dvberkel") | ||
name.set("Daan van Berkel") | ||
email.set("[email protected]") | ||
} | ||
developer { | ||
id.set("gmulders") | ||
name.set("Geert Mulders") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
url.set("https://github.com/alliander-opensource/measure") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters