Skip to content

Commit 872c0a4

Browse files
asarkarAbhijit Sarkar
authored andcommitted
Merge pull request #3 from asarkar/maven-central
Publish to Maven Central
2 parents 9ec5cbc + 0ec3b91 commit 872c0a4

File tree

6 files changed

+65
-53
lines changed

6 files changed

+65
-53
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ jobs:
1212
- uses: actions/checkout@v2
1313

1414
- name: Set up JDK
15-
uses: actions/setup-java@v1
15+
uses: actions/setup-java@v2
1616
with:
17+
distribution: 'zulu'
1718
java-version: 8
1819

1920
- name: Build and test

.github/workflows/publish.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,15 @@ jobs:
2929
exit 1
3030
3131
- name: Set up JDK
32-
uses: actions/setup-java@v1
32+
uses: actions/setup-java@v2
3333
with:
34+
distribution: 'zulu'
3435
java-version: 8
3536

36-
- name: Publish to Bintray
37-
run: ./gradlew -P bintrayUser=${{ secrets.BINTRAY_USER }} -P bintrayKey=${{ secrets.BINTRAY_KEY }} bintrayUpload
37+
- name: Publish to Maven Central
38+
run: |
39+
./gradlew -P signingKey=${{ secrets.SIGNING_KEY }} \
40+
-P signingPassword=${{ secrets.SIGNING_PASSWORD }} \
41+
-P sonatypeUsername=${{ secrets.SONATYPE_USERNAME }} \
42+
-P sonatypePassword=${{ secrets.SONATYPE_PASSWORD }} \
43+
publishToSonatype closeAndReleaseSonatypeStagingRepository

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ Requires Java 8 or later. Uses [embedded-redis](https://github.com/ozimov/embedd
77

88
## Installation
99

10-
You can find the latest version on Bintray. [ ![Download](https://api.bintray.com/packages/asarkar/mvn/com.asarkar.spring%3Aembedded-redis-spring/images/download.svg) ](https://bintray.com/asarkar/mvn/com.asarkar.spring%3Aembedded-redis-spring/_latestVersion)
11-
12-
It is also on Maven Central and jcenter.
10+
You can find the latest version on [Maven Central](https://search.maven.org/search?q=g:com.asarkar.spring%20AND%20a:embedded-redis-spring).
1311

1412
## Usage
1513

@@ -54,8 +52,8 @@ See KDoc for more details.
5452
## Contribute
5553

5654
This project is a volunteer effort. You are welcome to send pull requests, ask questions, or create issues.
57-
If you like it, you can help by spreading the word!
55+
you can help by spreading the word and "Starring" the GitHub repo!
5856

5957
## License
6058

61-
Copyright 2020 Abhijit Sarkar - Released under [Apache License v2.0](LICENSE).
59+
Copyright 2021 Abhijit Sarkar - Released under [Apache License v2.0](LICENSE).

build.gradle.kts

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
import java.util.Base64
2+
13
plugins {
24
kotlin("jvm")
5+
id("org.springframework.boot") apply false
36
`maven-publish`
47
id("org.jetbrains.dokka")
58
id("org.jlleitschuh.gradle.ktlint")
6-
id("com.jfrog.bintray")
9+
id("io.github.gradle-nexus.publish-plugin")
10+
id("org.jetbrains.kotlin.plugin.spring")
11+
signing
712
}
813

914
val projectGroup: String by project
@@ -14,21 +19,31 @@ version = projectVersion
1419
description = projectDescription
1520

1621
repositories {
22+
mavenCentral()
1723
jcenter()
1824
}
1925

26+
apply(plugin = "io.spring.dependency-management")
27+
2028
val jUnitVersion: String by project
21-
val springBootVersion: String by project
29+
the<io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension>().apply {
30+
imports {
31+
mavenBom(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)
32+
mavenBom("org.junit:junit-bom:$jUnitVersion")
33+
}
34+
}
35+
2236
val embeddedRedisVersion: String by project
2337
val lettuceVersion: String by project
38+
val springBootVersion: String by project
2439
dependencies {
25-
implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion"))
26-
implementation("org.springframework.boot:spring-boot-starter-test") {
40+
implementation("org.springframework.boot:spring-boot-starter-test:$springBootVersion") {
2741
exclude(group = "com.vaadin.external.google")
2842
}
29-
implementation("it.ozimov:embedded-redis:$embeddedRedisVersion")
30-
testImplementation("org.springframework.boot:spring-boot-starter")
31-
testImplementation(platform("org.junit:junit-bom:$jUnitVersion"))
43+
implementation("it.ozimov:embedded-redis:$embeddedRedisVersion") {
44+
exclude(group = "org.slf4j", module = "slf4j-simple")
45+
}
46+
testImplementation("org.springframework.boot:spring-boot-starter:$springBootVersion")
3247
testImplementation("org.junit.jupiter:junit-jupiter-api")
3348
testImplementation("org.junit.jupiter:junit-jupiter")
3449
testImplementation("io.lettuce:lettuce-core:$lettuceVersion")
@@ -122,33 +137,22 @@ publishing {
122137
}
123138
}
124139

125-
val bintrayRepo: String by project
126-
val projectLabels: String by project
127-
bintray {
128-
user = (findProperty("bintrayUser") ?: System.getenv("BINTRAY_USER"))?.toString()
129-
key = (findProperty("bintrayKey") ?: System.getenv("BINTRAY_KEY"))?.toString()
130-
setPublications(*publishing.publications.names.toTypedArray())
131-
with(pkg) {
132-
repo = bintrayRepo
133-
name = "${project.group}:${project.name}"
134-
desc = project.description
135-
websiteUrl = "https://$gitHubUrl"
136-
vcsUrl = "https://$gitHubUrl.git"
137-
setLabels(*projectLabels.split(",".toRegex()).map { it.trim() }.toTypedArray())
138-
setLicenses(licenseName)
139-
with(version) {
140-
name = project.version.toString()
141-
with(gpg) {
142-
sign = true
143-
}
144-
with(mavenCentralSync) {
145-
sync = true
146-
user = (findProperty("sonatypeUser") ?: System.getenv("SONATYPE_USER"))?.toString()
147-
password = (findProperty("sonatypePwd") ?: System.getenv("SONATYPE_PWD"))?.toString()
148-
}
140+
fun base64Decode(prop: String): String? {
141+
return project.findProperty(prop)?.let {
142+
String(Base64.getDecoder().decode(it.toString())).trim()
143+
}
144+
}
145+
146+
signing {
147+
useInMemoryPgpKeys(base64Decode("signingKey"), base64Decode("signingPassword"))
148+
sign(*publishing.publications.toTypedArray())
149+
}
150+
151+
nexusPublishing {
152+
repositories {
153+
sonatype {
154+
username.set(base64Decode("sonatypeUsername"))
155+
password.set(base64Decode("sonatypePassword"))
149156
}
150157
}
151-
publish = true
152-
override = false
153-
dryRun = false
154158
}

gradle.properties

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
kotlin.code.style=official
2+
org.gradle.warning.mode=all
3+
org.gradle.jvmargs=-XX:MaxMetaspaceSize=2G
24

3-
springBootVersion=2.3.4.RELEASE
5+
springBootVersion=2.5.2
46
embeddedRedisVersion=0.7.3
5-
lettuceVersion=6.0.1.RELEASE
7+
lettuceVersion=6.1.4.RELEASE
68
jUnitVersion=5.7.0
7-
kotlinVersion=1.4.10
9+
kotlin.version=1.5.20
810
dokkaPluginVersion=1.4.10.2
911
ktlintVersion=9.4.0
10-
bintrayPluginVersion=1.8.5
12+
nexusPluginVersion=1.0.0
1113

1214
projectGroup=com.asarkar.spring
13-
projectVersion=1.1.0
15+
projectVersion=1.1.1
1416
projectDescription=Starts a Redis server and makes the port available as Spring Boot environment property
15-
projectLabels=spring, spring-boot, redis, embedded-redis, test, integration-test
1617
licenseName=Apache-2.0
1718
licenseUrl=http://www.apache.org/licenses/LICENSE-2.0.txt
1819
developerName=Abhijit Sarkar
1920
developerEmail=contact@asarkar.com
2021
gitHubUsername=asarkar
21-
bintrayRepo=mvn

settings.gradle.kts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@ pluginManagement {
44
jcenter()
55
}
66

7-
val kotlinVersion: String by settings
7+
val kotlinVersion = settings.extra["kotlin.version"].toString()
88
val dokkaPluginVersion: String by settings
99
val ktlintVersion: String by settings
10-
val bintrayPluginVersion: String by settings
10+
val nexusPluginVersion: String by settings
11+
val springBootVersion: String by settings
1112
plugins {
1213
kotlin("jvm") version kotlinVersion
1314
`maven-publish`
1415
id("org.jetbrains.dokka") version dokkaPluginVersion
1516
id("org.jlleitschuh.gradle.ktlint") version ktlintVersion
16-
id("com.jfrog.bintray") version bintrayPluginVersion
17+
id("io.github.gradle-nexus.publish-plugin") version nexusPluginVersion
18+
id("org.springframework.boot") version springBootVersion
19+
id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion
1720
}
1821
}
1922

0 commit comments

Comments
 (0)