Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Publish to Maven Central on release

name: Publish
on:
release:
types: [released, prereleased]
jobs:
publish:
name: Release build and publish
runs-on: macOS-latest
permissions:
contents: read
packages: write
steps:
- name: Check out code
uses: actions/checkout@v6
- name: Set up JDK
uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: 24
- name: Publish to Maven Central
run: ./gradlew publishToMavenCentral --no-configuration-cache
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY_CONTENTS }}
- name: Publish to GitHub Packages
run: ./gradlew publishAllPublicationsToGitHubPackagesRepository --no-configuration-cache
env:
GH_PACKAGES_USER: ${{ secrets.GH_PACKAGES_USER }}
GH_PACKAGES_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/runTests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Run tests on every PR and push
# Run tests on every PR and push

name: Run Tests

Expand All @@ -18,4 +18,4 @@ jobs:
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Test with Gradle
run: ./gradlew test
run: ./gradlew jvmTest
134 changes: 47 additions & 87 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,22 @@
* Gradle build file for Keval
*/

import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

group = "com.notkamui.libs"
version = "1.1.1"

plugins {
kotlin("multiplatform") version "1.9.22"
java
`maven-publish`
signing
id("org.jetbrains.kotlin.multiplatform") version "2.3.21"
id("maven-publish")
id("com.vanniktech.maven.publish") version "0.36.0"
}

group = "com.notkamui.libs"
version = "1.1.1"

repositories {
mavenCentral()
}

java {
withJavadocJar()
withSourcesJar()
}

kotlin {
jvm()
js(IR) {
Expand All @@ -34,117 +29,82 @@ kotlin {
linuxX64()
mingwX64()

macosX64()
macosArm64()
iosSimulatorArm64()
iosX64()
iosArm64()
watchosSimulatorArm64()
watchosX64()
watchosArm32()
watchosArm64()
tvosSimulatorArm64()
tvosX64()
tvosArm64()

sourceSets {
val commonMain by getting {
}
val commonTest by getting {
dependencies {
implementation("org.jetbrains.kotlin:kotlin-test")
implementation("org.jetbrains.kotlin:kotlin-test-junit")
implementation(kotlin("test"))
}
}
}
}

tasks {
jar {
manifest {
attributes(
mapOf(
"Implementation-Title" to project.name,
"Implementation-Version" to project.version
)
)
}
}

withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}

withType<JavaCompile> {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
}
}

withType<Wrapper> {
distributionType = Wrapper.DistributionType.ALL
}
}

val isSnapshot = version.toString().endsWith("-SNAPSHOT")
mavenPublishing {
coordinates(group.toString(), "keval", version.toString())

val repositoryUrl = if (isSnapshot)
"https://oss.sonatype.org/content/repositories/snapshots/"
else
"https://oss.sonatype.org/service/local/staging/deploy/maven2/"
publishToMavenCentral()

publishing {
publications {
withType<MavenPublication> {
artifactId = artifactId.toLowerCase()

artifact(tasks.getByName("javadocJar"))

pom {
name.set("Keval")
description.set("A Kotlin mini library for mathematical expression string evaluation")
url.set("https://github.com/notKamui/Keval")
licenses {
license {
name.set("MIT License")
url.set("https://mit-license.org/")
}
}
developers {
developer {
id.set("notKamui")
name.set("Jimmy Teillard")
email.set("jimmy.teillard@notkamui.com")
}
}
scm {
connection.set("scm:git:git://github.com/notKamui/Keval.git")
developerConnection.set("scm:git:ssh://github.com/notKamui/Keval.git")
url.set("https://github.com/notKamui/Keval.git")
}
if (project.hasProperty("signingInMemoryKey")) {
signAllPublications()
}

pom {
name.set("Keval")
description.set("A Kotlin mini library for mathematical expression string evaluation")
url.set("https://github.com/notKamui/Keval")
licenses {
license {
name.set("MIT License")
url.set("https://mit-license.org/")
}
}
developers {
developer {
id.set("notKamui")
name.set("Jimmy Teillard")
email.set("jimmy.teillard@notkamui.com")
}
}
scm {
connection.set("scm:git:git://github.com/notKamui/Keval.git")
developerConnection.set("scm:git:ssh://github.com/notKamui/Keval.git")
url.set("https://github.com/notKamui/Keval.git")
}
}
}

publishing {
repositories {
maven {
setUrl(repositoryUrl)
name = "GitHubPackages"

url = uri("https://maven.pkg.github.com/notKamui/${rootProject.name}")

credentials {
username = project.properties["ossrhUsername"] as String? ?: "Unknown user"
password = project.properties["ossrhPassword"] as String? ?: "Unknown user"
}
}
if (!isSnapshot) {
maven {
name = "GitHubPackages"
setUrl("https://maven.pkg.github.com/notKamui/${project.name}")
credentials {
username = project.properties["githubUsername"] as String? ?: "Unknown user"
password = project.properties["githubPassword"] as String? ?: "Unknown user"
}
username = project.findProperty("githubPackagesUser") as String? ?: System.getenv("GH_PACKAGES_USER")
password = project.findProperty("githubPackagesToken") as String? ?: System.getenv("GH_PACKAGES_TOKEN")
}
}
}
}

signing {
sign(publishing.publications)
}
10 changes: 5 additions & 5 deletions gradle.properties.template
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
mavenCentralUsername=
mavenCentralPassword=

signing.keyId=
signing.password=
signing.secretKeyRingFile=

ossrhUsername=
ossrhPassword=

githubUsername=
githubPassword=
githubPackagesUser=
githubPackagesToken=
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 4 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-all.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
40 changes: 22 additions & 18 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading