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
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ jobs:

- name: Release to sonatype
env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_KEY_PASSWORD: ${{ secrets.GPG_KEY_PASSWORD }}
GPG_KEY_SECRET: ${{ secrets.GPG_KEY_SECRET }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USER }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_KEY_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY_SECRET }}
PACKAGE_VERSION: ${{ github.event.release.tag_name }}
run: ./gradlew publishJsPublicationToMavenRepository
run: ./gradlew publishToMavenCentral --debug

publish:
if: ${{ github.event_name == 'release' }}
Expand Down
100 changes: 43 additions & 57 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ plugins {
alias(libs.plugins.detekt)
alias(libs.plugins.dokka)
alias(libs.plugins.kover)
alias(libs.plugins.maven.publish)
alias(libs.plugins.sqldelight)
id("maven-publish")
id("signing")
}

val defaultGroupId = "cz.sazel.sqldelight"
val nameStr = "node-sqlite3-driver"
val versionBase = "0.5.0"

val localProperties = Properties().apply {
Expand Down Expand Up @@ -99,7 +100,7 @@ kotlin {
publicationsFromMainHost = listOf(js()).map { it.name } + "kotlinMultiplatform"

dokka {
moduleName = "node-sqlite3-driver"
moduleName = nameStr
moduleVersion = versionStr

dokkaSourceSets {
Expand All @@ -119,47 +120,7 @@ val javadocJar = tasks.register<Jar>("javadocJar") {
from(layout.buildDirectory.dir("dokka/html"))
}

publishing {
publications {
matching { it.name in publicationsFromMainHost }.all {
val targetPublication = this@all
tasks.withType<AbstractPublishToMaven>().matching { it.publication == targetPublication }
.configureEach { onlyIf { findProperty("isMainHost") == "true" } }
}


withType<MavenPublication> {
artifact(javadocJar)

pom {
name.set("node-sqlite3-driver")
description.set("Driver for the library SQLDelight that supports sqlite3 Node.js module")
licenses {
license {
name.set("Apache-2.0")
url.set("https://opensource.org/licenses/Apache-2.0")
}
}
url.set("https://github.com/wojta/sqldelight-node-sqlite3-driver")
issueManagement {
system.set("Github")
url.set("https://github.com/wojta/sqldelight-node-sqlite3-driver/issues")
}
scm {
connection.set("https://github.com/wojta/sqldelight-node-sqlite3-driver.git")
url.set("https://github.com/wojta/sqldelight-node-sqlite3-driver")
}
developers {
developer {
name.set("Vojtěch Sázel")
email.set("sqldelight@sazel.cz")
}
}
}
}

}

mavenPublishing {
repositories {
val githubUserName = System.getenv("GITHUB_USER") ?: localProperties["github.user"] as String?
if (githubUserName != null) { // Github packages repo
Expand All @@ -174,30 +135,55 @@ publishing {
}
}
}
maven { // OSS Sonatype (default)
val isSnapshot = version.toString().endsWith("SNAPSHOT")
val destination = if (!isSnapshot) {
"https://ossrh-staging-api.central.sonatype.com/service/local/"
} else "https://central.sonatype.com/repository/maven-snapshots/"
url = uri(destination)
mavenCentral {
credentials {
username = System.getenv("SONATYPE_USER") ?: localProperties["sonatype.user"] as String?
password = System.getenv("SONATYPE_PASSWORD") ?: localProperties["sonatype.password"] as String?
}
}
mavenLocal()
}
}
coordinates(group.toString(), nameStr, versionStr)

signing {
useInMemoryPgpKeys(
System.getenv("GPG_KEY_SECRET") ?: localProperties["gpg.keySecret"] as String?,
System.getenv("GPG_KEY_PASSWORD") ?: localProperties["gpg.keyPassword"] as String?
)
sign(publishing.publications)
}

signing {
useInMemoryPgpKeys(
System.getenv("GPG_KEY_SECRET") ?: localProperties["gpg.keySecret"] as String?,
System.getenv("GPG_KEY_PASSWORD") ?: localProperties["gpg.keyPassword"] as String?
)
// publish to Maven Central
publishToMavenCentral()

sign(publishing.publications)
pom {
name.set("node-sqlite3-driver")
description.set("Driver for the library SQLDelight that supports sqlite3 Node.js module")
licenses {
license {
name.set("Apache-2.0")
url.set("https://opensource.org/licenses/Apache-2.0")
}
}
url.set("https://github.com/wojta/sqldelight-node-sqlite3-driver")
issueManagement {
system.set("Github")
url.set("https://github.com/wojta/sqldelight-node-sqlite3-driver/issues")
}
scm {
connection.set("https://github.com/wojta/sqldelight-node-sqlite3-driver.git")
url.set("https://github.com/wojta/sqldelight-node-sqlite3-driver")
}
developers {
developer {
name.set("Vojtěch Sázel")
email.set("sqldelight@sazel.cz")
}
}
}
}


// workaround for missing sqlite3 bindings
val bindingsInstall = tasks.register("sqlite3BindingsInstall") {
doFirst {
Expand Down Expand Up @@ -225,7 +211,7 @@ detekt {
buildUponDefaultConfig = true // preconfigure defaults
allRules = false // activate all available (even unstable) rules.
config.setFrom("$projectDir/gradle/detekt/detekt.yml") // point to your custom config defining rules to run, overwriting default behavior
// baseline = file("$projectDir/config/baseline.xml") // a way of suppressing issues before introducing detekt
// baseline = file("$projectDir/config/baseline.xml") // a way of suppressing issues before introducing detekt

reports {
html.required.set(true) // observe findings in your browser with structure and code snippets
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
kotlin.code.style=official
kotlin.js.generate.executable.default=false
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
signAllPublications=true
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ kotlinCoroutines = "1.10.2"
kover = "0.9.1"
node-sqlite3 = "5.1.7"
node-js = "22.13.0"
maven-publish = "0.34.0"
sqldelight = "2.1.0"

[libraries]
Expand All @@ -20,3 +21,4 @@ dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
sqldelight = { id = "app.cash.sqldelight", version.ref = "sqldelight" }
maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "maven-publish" }
Loading