diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c65f683..aeaf944 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,20 +1,46 @@ -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: - runs-on: macOS-latest - + publish: + name: Publish library at mavenCentral + runs-on: macOS-latest + 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 }} + steps: + - uses: actions/checkout@v1 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Cocoapods install + run: (cd sample/ios-app && pod install) + - name: Publish library + run: ./gradlew publish + release: + name: Create release + needs: publish + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - java-version: 1.8 - - name: Cocoapods install - run: (cd sample/ios-app && pod install) - - name: Publish library - run: ./gradlew publishAllPublicationsToBintrayRepository -DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }} + 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 ee2af2a..03da3e5 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ![moko-socket-io](https://user-images.githubusercontent.com/5010169/80988267-712b7e80-8e5d-11ea-955e-c788a567c64e.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-socket-io/images/download.svg) ](https://bintray.com/icerockdev/moko/moko-socket-io/_latestVersion) ![kotlin-version](https://img.shields.io/badge/kotlin-1.4.10-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/socket-io) ](https://repo1.maven.org/maven2/dev/icerock/moko/socket-io) ![kotlin-version](https://img.shields.io/badge/kotlin-1.4.31-orange) # Mobile Kotlin socket io This is a Kotlin MultiPlatform library that provides real-time, event-based communication for iOS and Android. @@ -24,17 +24,21 @@ This is a Kotlin MultiPlatform library that provides real-time, event-based comm - iOS version 9.0+ ## Versions +### Bintray - kotlin 1.3.72 - 0.1.0 - kotlin 1.4.10 - 0.2.0 +### mavenCentral +- kotlin 1.4.31 + - 0.2.1 ## Installation root build.gradle ```groovy allprojects { repositories { - maven { url = "https://dl.bintray.com/icerockdev/moko" } + mavenCentral() } } ``` @@ -42,7 +46,7 @@ allprojects { project build.gradle ```groovy dependencies { - commonMainApi("dev.icerock.moko:socket-io:0.2.0") + commonMainApi("dev.icerock.moko:socket-io:0.2.1") commonMainApi("org.jetbrains.kotlinx:kotlinx-serialization-core:1.0.0-RC") } @@ -55,7 +59,7 @@ cocoaPods { Podfile ```ruby -pod 'mokoSocketIo', :git => 'https://github.com/icerockdev/moko-socket-io.git', :tag => 'release/0.2.0' +pod 'mokoSocketIo', :git => 'https://github.com/icerockdev/moko-socket-io.git', :tag => 'release/0.2.1' ``` ## Usage diff --git a/build.gradle.kts b/build.gradle.kts index 2344a20..e1bb68e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,12 +8,15 @@ plugins { 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") + includeGroup("org.jetbrains.kotlinx") + } + } } apply(plugin = Deps.Plugins.detekt.id) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index f14515e..0372d49 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,16 +1,20 @@ plugins { - id("org.jetbrains.kotlin.jvm") version("1.4.10") + 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.7.1") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10") + 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.0.1") } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Deps.kt b/buildSrc/src/main/kotlin/Deps.kt index 2061b2f..2c41340 100755 --- a/buildSrc/src/main/kotlin/Deps.kt +++ b/buildSrc/src/main/kotlin/Deps.kt @@ -4,14 +4,14 @@ object Deps { - private const val kotlinVersion = "1.4.0" - private const val detektVersion = "1.7.4" + private const val kotlinVersion = "1.4.31" + private const val detektVersion = "1.15.0" private const val androidAppCompatVersion = "1.1.0" private const val androidSocketIoVersion = "1.0.0" private const val kotlinxSerializationVersion = "1.0.0-RC" - const val mokoSocketIoVersion = "0.2.0" + const val mokoSocketIoVersion = "0.2.1" object Android { @@ -30,6 +30,7 @@ object Deps { val mobileMultiplatform = GradlePlugin(id = "dev.icerock.mobile.multiplatform") val mavenPublish = GradlePlugin(id = "org.gradle.maven-publish") + val signing = GradlePlugin(id = "signing") val detekt = GradlePlugin(id = "io.gitlab.arturbosch.detekt", version = detektVersion) val iosFramework = GradlePlugin(id = "dev.icerock.mobile.multiplatform.ios-framework") diff --git a/gradle.properties b/gradle.properties index 37ae0eb..3eb22e0 100755 --- a/gradle.properties +++ b/gradle.properties @@ -7,8 +7,4 @@ kotlin.native.enableDependencyPropagation=false 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 +android.useAndroidX=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 12d38de..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.6.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/socket-io/build.gradle.kts b/socket-io/build.gradle.kts index 86571bb..440e36c 100644 --- a/socket-io/build.gradle.kts +++ b/socket-io/build.gradle.kts @@ -2,12 +2,16 @@ * Copyright 2020 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.kotlinAndroidExtensions) plugin(Deps.Plugins.mobileMultiplatform) plugin(Deps.Plugins.mavenPublish) + plugin(Deps.Plugins.signing) } group = "dev.icerock.moko" @@ -22,13 +26,65 @@ dependencies { } } +val javadocJar by tasks.registering(Jar::class) { + archiveClassifier.set("javadoc") +} + publishing { - repositories.maven("https://api.bintray.com/maven/icerockdev/moko/moko-socket-io/;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") + } + } + + publications.withType { + // Stub javadoc.jar artifact + artifact(javadocJar.get()) + + // Provide artifacts information requited by Maven Central + pom { + name.set("MOKO socket io") + description.set("Socket.IO implementation Kotlin Multiplatform library") + url.set("https://github.com/icerockdev/moko-socket-io") + licenses { + license { + url.set("https://github.com/icerockdev/moko-socket-io/blob/master/LICENSE.md") + } + } + + developers { + developer { + id.set("Alex009") + name.set("Aleksey Mikhailov") + email.set("aleksey.mikhailov@icerockdev.com") + } + developer { + id.set("Dorofeev") + name.set("Andrey Dorofeef") + email.set("adorofeev@icerockdev.com") + } + } + + scm { + connection.set("scm:git:ssh://github.com/icerockdev/moko-socket-io.git") + developerConnection.set("scm:git:ssh://github.com/icerockdev/moko-socket-io.git") + url.set("https://github.com/icerockdev/moko-socket-io") + } + } + } + + 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)) + } + if (signingKeyId != null) { + useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) + sign(publishing.publications) } } }