diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 131c7b226..44f3d56fd 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -228,3 +228,11 @@ jobs: asset_path: amethyst/build/outputs/bundle/fdroidRelease/amethyst-fdroid-release.aab asset_name: amethyst-fdroid-${{ github.ref_name }}.aab asset_content_type: application/zip + + - name: Publish Quartz Lib + run: ./gradlew publishAllPublicationsToMavenCentral --no-configuration-cache + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} diff --git a/README.md b/README.md index d1bf11d23..f8cbbdf46 100644 --- a/README.md +++ b/README.md @@ -237,26 +237,25 @@ openssl base64 < | tr -d '\n' | tee some_signing_key.j ## Using the Quartz library -Setup [JitPack.io](https://jitpack.io/#vitorpamplona/amethyst/v0.84.3) to your build file +### Installing -Add `maven { url 'https://jitpack.io' }` to settings.gradle at the end of repositories: +Add the following line to your `commonMain` dependencies: ```gradle -dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) - repositories { - mavenCentral() - maven { url 'https://jitpack.io' } - } -} +implementation('com.github.vitorpamplona.amethyst:quartz:') ``` -Add the dependency by using one of the versions [here](https://jitpack.io/#vitorpamplona/amethyst/) +Variations to each platform are also available: ```gradle -implementation('com.github.vitorpamplona.amethyst:quartz:') +implementation('com.github.vitorpamplona.amethyst:quartz-android:') +implementation('com.github.vitorpamplona.amethyst:quartz-jvm:') +implementation('com.github.vitorpamplona.amethyst:quartz-iosarm64:') +implementation('com.github.vitorpamplona.amethyst:quartz-iossimulatorarm64:') ``` +### How to use + Manage logged in users with the `KeyPair` class ```kt diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1431312e6..896582390 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -60,6 +60,7 @@ androidxCollection = "1.5.0" kotlinStdlib = "2.2.20" kotlinTest = "2.2.10" core = "1.7.0" +mavenPublish = "0.34.0" [libraries] abedElazizShe-image-compressor = { group = "com.github.AbedElazizShe", name = "LightCompressor", version.ref = "lightcompressor" } @@ -164,4 +165,5 @@ jetbrainsKotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } jetbrainsComposeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } serialization = { id = 'org.jetbrains.kotlin.plugin.serialization', version.ref = 'kotlinxSerializationPlugin' } kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } -androidKotlinMultiplatformLibrary = { id = "com.android.kotlin.multiplatform.library", version.ref = "agp" } \ No newline at end of file +androidKotlinMultiplatformLibrary = { id = "com.android.kotlin.multiplatform.library", version.ref = "agp" } +vanniktech-mavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish" } \ No newline at end of file diff --git a/quartz/build.gradle.kts b/quartz/build.gradle.kts index 1d0752915..e15428326 100644 --- a/quartz/build.gradle.kts +++ b/quartz/build.gradle.kts @@ -1,9 +1,11 @@ +import com.vanniktech.maven.publish.KotlinMultiplatform import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { alias(libs.plugins.kotlinMultiplatform) alias(libs.plugins.androidLibrary) alias(libs.plugins.serialization) + alias(libs.plugins.vanniktech.mavenPublish) } android { @@ -232,4 +234,56 @@ kotlin { dependsOn(iosTest.get()) // iosSimulatorArm64Main depends on iosMain } } +} + + +mavenPublishing { + // sources publishing is always enabled by the Kotlin Multiplatform plugin + configure( + KotlinMultiplatform( + // whether to publish a sources jar + sourcesJar = true, + // configure which Android library variants to publish if this project has an Android target + // defaults to "release" when using the main plugin and nothing for the base plugin + androidVariantsToPublish = listOf("release"), + ) + ) + + coordinates( + groupId = "com.vitorpamplona.quartz", + artifactId = "quartz", + version = "1.03.0" + ) + + // Configure publishing to Maven Central + //publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true) + publishToMavenCentral(automaticRelease = true) + + // Enable GPG signing for all publications + signAllPublications() + + pom { + name = "Quartz: Nostr Library for Kotlin Multiplatform" + description = "Nostr library ported to Kotlin/Multiplatform for JVM, Android, iOS & Linux" + inceptionYear = "2025" + url = "https://github.com/vitorpamplona/amethyst/" + licenses { + license { + name = "MIT License" + url = "https://github.com/vitorpamplona/amethyst/blob/main/LICENSE" + } + } + developers { + developer { + id = "vitorpamplona" + name = "Vitor Pamplona" + url = "http://vitorpamplona.com" + email = "vitor@vitorpamplona.com" + } + } + scm { + url = "https://github.com/vitorpamplona/amethyst/" + connection = "https://github.com/vitorpamplona/amethyst/.git" + } + } } \ No newline at end of file