Skip to content

Commit c61938f

Browse files
Merge pull request #6 from sqids/add-maven-central-configs
Add build configs for deploying to maven central
2 parents 45cd901 + 59959b8 commit c61938f

File tree

1 file changed

+64
-2
lines changed

1 file changed

+64
-2
lines changed

build.gradle

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
plugins {
22
id("org.jetbrains.kotlin.jvm") version "1.6.0"
33
id("java-library")
4+
id("maven-publish")
5+
id("signing")
46
}
57

8+
var rootArtifactId = "sqids-kotlin"
9+
var projectUrl = "https://sqids.org/kotlin"
10+
group = "org.sqids"
11+
version = "0.1.1-SNAPSHOT"
12+
613
repositories {
714
mavenCentral()
815
}
@@ -11,12 +18,67 @@ dependencies {
1118
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
1219
}
1320

14-
tasks.named('test', Test) {
21+
tasks.named("test", Test) {
1522
useJUnitPlatform()
1623

17-
maxHeapSize = '1G'
24+
maxHeapSize = "1G"
1825

1926
testLogging {
2027
showStandardStreams = true
2128
}
29+
}
30+
31+
publishing {
32+
publications {
33+
34+
mavenJava(MavenPublication) {
35+
groupId = group
36+
artifactId = rootArtifactId
37+
version = version
38+
from components.java
39+
pom {
40+
name = "Sqids"
41+
description = "Generate short YouTube-looking IDs from numbers."
42+
url = projectUrl
43+
properties = [
44+
"parent.groupId": "org.sonatype.oss",
45+
"parent.artifactId": "oss-parent",
46+
"parent.version": "7"
47+
]
48+
licenses {
49+
license {
50+
name = "MIT License"
51+
url = "https://github.com/sqids/sqids-kotlin/blob/main/LICENSE"
52+
}
53+
}
54+
developers {
55+
developer {
56+
id = "kevinxmorales"
57+
name = "Kevin Morales"
58+
59+
}
60+
}
61+
scm {
62+
connection = "scm:git:https://github.com/sqids/sqids-kotlin.git"
63+
developerConnection = "scm:git:ssh://[email protected]:sqids/sqids-kotlin.git"
64+
url = projectUrl
65+
}
66+
}
67+
}
68+
}
69+
repositories {
70+
maven {
71+
url = version.endsWith('SNAPSHOT') ?
72+
"https://s01.oss.sonatype.org/content/repositories/snapshots/" :
73+
"https://s01.oss.sonatype.org/content/repositories/releases/"
74+
credentials {
75+
username "${System.getenv("SONATYPE_USERNAME")}"
76+
password "${System.getenv("SONATYPE_PASSWORD")}"
77+
}
78+
}
79+
}
80+
signing {
81+
useGpgCmd()
82+
sign publishing.publications.mavenJava
83+
}
2284
}

0 commit comments

Comments
 (0)