Skip to content

Commit

Permalink
Publish to Maven Central
Browse files Browse the repository at this point in the history
  • Loading branch information
oyakovlev committed Mar 26, 2021
1 parent 96b44d8 commit f393bac
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 12 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/distribution.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
name: Bintray Distribution
name: Maven Central Distribution
on:
release:
types: [published]
types: [ published ]
jobs:
gradle:
strategy:
matrix:
os: [ubuntu-latest]
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 11
- name: Build and publish to Bintray
run: ./gradlew :fcm-push-service:publish -DBINTRAY_USER=${{ secrets.BINTRAY_USER }} -DBINTRAY_KEY=${{ secrets.BINTRAY_KEY }} -PlibraryPublish
- name: Build and publish to mavenCentral
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 }}
run: ./gradlew publish -PlibraryPublish
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
````kotlin
// Append repository
repositories {
maven { url = url("https://dl.bintray.com/icerockdev/backend") }
mavenCentral()
}

// Append dependency
implementation("com.icerockdev.service:fcm-push-service:0.1.0")
implementation("com.icerockdev.service:fcm-push-service:0.1.1")
````

## Koin configure
Expand Down
60 changes: 55 additions & 5 deletions fcm-push-service/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import java.util.Base64
import kotlin.text.String
/*
* Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

group = "com.icerockdev.service"
version = "0.1.0"
version = "0.1.1"

plugins {
id("org.jetbrains.kotlin.jvm")
id("kotlin-kapt")
id("maven-publish")
id("java-library")
id("signing")
}

apply(plugin = "kotlin")
Expand Down Expand Up @@ -39,6 +42,7 @@ dependencies {
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
withJavadocJar()
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
Expand All @@ -52,18 +56,64 @@ repositories {
}

publishing {
repositories.maven("https://api.bintray.com/maven/icerockdev/backend/fcm-push-service/;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 {
register("mavenJava", MavenPublication::class) {
from(components["java"])
artifact(sourcesJar.get())
pom {
name.set("Fcm push service")
description.set("Tools for sending fcm push by kotlin")
url.set("https://github.com/icerockdev/fcm-push-service")
licenses {
license {
url.set("https://github.com/icerockdev/fcm-push-service/blob/master/LICENSE.md")
}
}

developers {
developer {
id.set("YokiToki")
name.set("Stanislav")
email.set("[email protected]")
}

developer {
id.set("AlexeiiShvedov")
name.set("Alex Shvedov")
email.set("[email protected]")
}

developer {
id.set("oyakovlev")
name.set("Oleg Yakovlev")
email.set("[email protected]")
}
}

scm {
connection.set("scm:git:ssh://github.com/icerockdev/fcm-push-service.git")
developerConnection.set("scm:git:ssh://github.com/icerockdev/fcm-push-service.git")
url.set("https://github.com/icerockdev/fcm-push-service")
}
}
}

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["mavenJava"])
}
}
}

0 comments on commit f393bac

Please sign in to comment.