-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from icerockdev/maven-central-publish
Publish to Maven Central
- Loading branch information
Showing
3 changed files
with
68 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
|
@@ -39,6 +42,7 @@ dependencies { | |
java { | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
withJavadocJar() | ||
} | ||
|
||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { | ||
|
@@ -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"]) | ||
} | ||
} | ||
} |