From c594456971e95b4ef21b33928af716f7f4a7e4f4 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Sat, 27 Mar 2021 14:25:59 +0700 Subject: [PATCH 1/3] #20 maven central configuration --- .github/workflows/publish.yml | 31 ++++++++++-- README.md | 10 ++-- build.gradle.kts | 11 +++-- buildSrc/build.gradle.kts | 14 ++++-- buildSrc/src/main/kotlin/Deps.kt | 5 +- gradle.properties | 4 -- gradle/wrapper/gradle-wrapper.properties | 2 +- parcelize/build.gradle.kts | 62 ++++++++++++++++++++++-- 8 files changed, 110 insertions(+), 29 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 13ce4c1..8cd57e5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,11 +1,16 @@ -name: KMP library publish +name: Create release on: - release: - types: [published] + workflow_dispatch: + inputs: + version: + description: 'Version' + default: '0.1.0' + required: true jobs: - build: + publish: + name: Publish library at mavenCentral runs-on: ${{ matrix.os }} strategy: matrix: @@ -17,4 +22,20 @@ jobs: with: java-version: 1.8 - name: Publish - run: ./gradlew publishAllPublicationsToBintrayRepository -DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }} -DIS_MAIN_HOST=${{ matrix.os == 'ubuntu-latest' }} + run: ./gradlew publish -DIS_MAIN_HOST=${{ matrix.os == 'ubuntu-latest' }} + release: + name: Create release + needs: publish + runs-on: ubuntu-latest + steps: + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + commitish: ${{ github.ref }} + tag_name: release/${{ github.event.inputs.version }} + release_name: Release ${{ github.event.inputs.version }} + body: "Will be filled later" + draft: true diff --git a/README.md b/README.md index d1e8d9b..16e6513 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ![moko-parcelize](img/logo.png) -[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) [![Download](https://api.bintray.com/packages/icerockdev/moko/moko-parcelize/images/download.svg) ](https://bintray.com/icerockdev/moko/moko-parcelize/_latestVersion) ![kotlin-version](https://img.shields.io/badge/kotlin-1.4.21-orange) +[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) [![Download](https://img.shields.io/maven-central/v/dev.icerock.moko/parcelize) ](https://repo1.maven.org/maven2/dev/icerock/moko/parcelize) ![kotlin-version](https://img.shields.io/badge/kotlin-1.4.31-orange) # MOKO Parcelize This is a Kotlin Multiplatform library that supports Parcelize in common code. @@ -25,6 +25,7 @@ This is a Kotlin Multiplatform library that supports Parcelize in common code. - iOS version 9.0+ ## Versions +### Bintray - kotlin 1.3.50 - 0.1.0 - kotlin 1.3.60 @@ -37,13 +38,16 @@ This is a Kotlin Multiplatform library that supports Parcelize in common code. - 0.5.0 - kotlin 1.4.21 - 0.6.0 +### mavenCentral +- kotlin 1.4.31 + - 0.6.1 ## Installation root build.gradle ```groovy allprojects { repositories { - maven { url = "https://dl.bintray.com/icerockdev/moko" } + mavenCentral() } } ``` @@ -51,7 +55,7 @@ allprojects { project build.gradle ```groovy dependencies { - commonMainApi("dev.icerock.moko:parcelize:0.6.0") + commonMainApi("dev.icerock.moko:parcelize:0.6.1") } ``` diff --git a/build.gradle.kts b/build.gradle.kts index fd60371..79cc4a5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,13 +4,14 @@ allprojects { repositories { - + mavenCentral() google() - jcenter() - maven { url = uri("https://kotlin.bintray.com/kotlin") } - maven { url = uri("https://kotlin.bintray.com/kotlinx") } - maven { url = uri("https://dl.bintray.com/icerockdev/moko") } + jcenter { + content { + includeGroup("org.jetbrains.trove4j") + } + } } plugins.withId(Deps.Plugins.androidLibrary.id) { diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 2e82fdf..e856d25 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -3,18 +3,22 @@ */ plugins { - id("org.jetbrains.kotlin.jvm") version("1.4.21") + id("org.jetbrains.kotlin.jvm") version("1.4.31") } repositories { - jcenter() + mavenCentral() google() - maven { url = uri("https://dl.bintray.com/icerockdev/plugins") } + jcenter { + content { + includeGroup("org.jetbrains.trove4j") + } + } } dependencies { - implementation("dev.icerock:mobile-multiplatform:0.9.0") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21") + implementation("dev.icerock:mobile-multiplatform:0.9.1") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.31") implementation("com.android.tools.build:gradle:4.1.1") } diff --git a/buildSrc/src/main/kotlin/Deps.kt b/buildSrc/src/main/kotlin/Deps.kt index c1b0122..6345bb5 100755 --- a/buildSrc/src/main/kotlin/Deps.kt +++ b/buildSrc/src/main/kotlin/Deps.kt @@ -3,9 +3,9 @@ */ object Deps { - private const val kotlinVersion = "1.4.21" + private const val kotlinVersion = "1.4.31" private const val androidAppCompatVersion = "1.1.0" - const val mokoParcelizeVersion = "0.6.0" + const val mokoParcelizeVersion = "0.6.1" object Android { const val compileSdk = 28 @@ -23,6 +23,7 @@ object Deps { val mobileMultiPlatform = GradlePlugin(id = "dev.icerock.mobile.multiplatform") val appleFramework = GradlePlugin(id = "dev.icerock.mobile.multiplatform.apple-framework") val mavenPublish = GradlePlugin(id = "maven-publish") + val signing = GradlePlugin(id = "signing") } object Libs { diff --git a/gradle.properties b/gradle.properties index 7f2bce9..7c2bc5d 100755 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,3 @@ kotlin.mpp.enableGranularSourceSetsMetadata=true kotlin.mpp.enableCompatibilityMetadataVariant=true android.useAndroidX=true - -# Workaround for Bintray treating .sha512 files as artifacts -# https://github.com/gradle/gradle/issues/11412 -systemProp.org.gradle.internal.publish.checksums.insecure=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index da9702f..442d913 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/parcelize/build.gradle.kts b/parcelize/build.gradle.kts index 5c76178..5139205 100644 --- a/parcelize/build.gradle.kts +++ b/parcelize/build.gradle.kts @@ -2,12 +2,16 @@ * Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. */ +import java.util.Base64 +import kotlin.text.String + plugins { plugin(Deps.Plugins.androidLibrary) plugin(Deps.Plugins.kotlinMultiPlatform) plugin(Deps.Plugins.kotlinParcelize) plugin(Deps.Plugins.mobileMultiPlatform) plugin(Deps.Plugins.mavenPublish) + plugin(Deps.Plugins.signing) } group = "dev.icerock.moko" @@ -61,13 +65,17 @@ fun org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension.windows() { mingwX86() } +val javadocJar by tasks.registering(Jar::class) { + archiveClassifier.set("javadoc") +} + publishing { - repositories.maven("https://api.bintray.com/maven/icerockdev/moko/moko-parcelize/;publish=1") { - name = "bintray" + repositories.maven("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") { + name = "OSSRH" credentials { - username = System.getProperty("BINTRAY_USER") - password = System.getProperty("BINTRAY_KEY") + username = System.getenv("OSSRH_USER") + password = System.getenv("OSSRH_KEY") } } @@ -92,4 +100,50 @@ publishing { .matching { it.publication == targetPublication } .all { onlyIf { System.getProperty("IS_MAIN_HOST") == "true" } } } + + publications.withType { + // Stub javadoc.jar artifact + artifact(javadocJar.get()) + + // Provide artifacts information requited by Maven Central + pom { + name.set("MOKO parcelize") + description.set("@Parcelize support for android from common code in Kotlin Multiplatform") + url.set("https://github.com/icerockdev/moko-parcelize") + licenses { + license { + url.set("https://github.com/icerockdev/moko-parcelize/blob/master/LICENSE.md") + } + } + + developers { + developer { + id.set("Alex009") + name.set("Aleksey Mikhailov") + email.set("aleksey.mikhailov@icerockdev.com") + } + developer { + id.set("nrobi144") + name.set("Nagy Robert") + email.set("nagyrobi144@gmail.com") + } + } + + scm { + connection.set("scm:git:ssh://github.com/icerockdev/moko-parcelize.git") + developerConnection.set("scm:git:ssh://github.com/icerockdev/moko-parcelize.git") + url.set("https://github.com/icerockdev/moko-parcelize") + } + } + } + + signing { + val signingKeyId: String? = System.getenv("SIGNING_KEY_ID") + val signingPassword: String? = System.getenv("SIGNING_PASSWORD") + val signingKey: String? = System.getenv("SIGNING_KEY")?.let { base64Key -> + String(Base64.getDecoder().decode(base64Key)) + } + useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) + sign(publishing.publications) + } } From 58963456b456b9044e5f137de609cc61fa7c7171 Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Sat, 27 Mar 2021 14:33:03 +0700 Subject: [PATCH 2/3] #20 pass lost env --- .github/workflows/publish.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8cd57e5..ebbc193 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,6 +12,12 @@ jobs: publish: name: Publish library at mavenCentral runs-on: ${{ matrix.os }} + env: + OSSRH_USER: ${{ secrets.OSSRH_USER }} + OSSRH_KEY: ${{ secrets.OSSRH_KEY }} + SIGNING_KEY_ID: ${{ secrets.SIGNING_KEYID }} + SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} + SIGNING_KEY: ${{ secrets.GPG_KEY_CONTENTS }} strategy: matrix: os: [macos-latest, windows-latest, ubuntu-latest] From 5bca936b982cde15412b349ae15899099665bf1f Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Sat, 27 Mar 2021 14:35:34 +0700 Subject: [PATCH 3/3] #20 fix publish to maven local without signing --- parcelize/build.gradle.kts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/parcelize/build.gradle.kts b/parcelize/build.gradle.kts index 5139205..a283d3a 100644 --- a/parcelize/build.gradle.kts +++ b/parcelize/build.gradle.kts @@ -66,7 +66,7 @@ fun org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension.windows() { } val javadocJar by tasks.registering(Jar::class) { - archiveClassifier.set("javadoc") + archiveClassifier.set("javadoc") } publishing { @@ -143,7 +143,9 @@ publishing { val signingKey: String? = System.getenv("SIGNING_KEY")?.let { base64Key -> String(Base64.getDecoder().decode(base64Key)) } - useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) - sign(publishing.publications) + if (signingKeyId != null) { + useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) + sign(publishing.publications) + } } }