-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish spring-boot-adapter to Maven Central (#51)
* copy gradle settings from inngest * update publication name * no longer require token for tests * remove gh token requirement from README * add adapter's VERSION file as part of filtering --------- Co-authored-by: Darwin D Wu <[email protected]>
- Loading branch information
Showing
6 changed files
with
145 additions
and
22 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
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
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
0.0.2 |
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,27 +1,25 @@ | ||
import org.gradle.api.tasks.testing.logging.TestExceptionFormat | ||
import org.gradle.api.tasks.testing.logging.TestLogEvent | ||
|
||
group = "com.inngest" | ||
description = "Spring Boot adapter for Inngest SDK" | ||
version = "0.0.1" | ||
version = file("VERSION").readText().trim() | ||
|
||
plugins { | ||
`java-library` | ||
id("java-library") | ||
id("maven-publish") | ||
id("signing") | ||
id("io.spring.dependency-management") version "1.1.4" | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
withJavadocJar() | ||
withSourcesJar() | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
|
||
maven { | ||
url = uri("https://maven.pkg.github.com/inngest/inngest-kt") | ||
credentials { | ||
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR") | ||
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN") | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
|
@@ -41,22 +39,135 @@ dependencyManagement { | |
|
||
publishing { | ||
repositories { | ||
// NOTE: Does not work: https://central.sonatype.org/publish/publish-portal-gradle/ | ||
// maven { | ||
// name = "OSSRH" | ||
// url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") | ||
// credentials { | ||
// username = System.getenv("MAVEN_USERNAME") | ||
// password = System.getenv("MAVEN_PASSWORD") | ||
// } | ||
// } | ||
|
||
// NOTE: create a local repo and bundle this to upload it to Maven Central for now | ||
maven { | ||
// local repo | ||
val releasesRepoUrl = uri(layout.buildDirectory.dir("repos/releases")) | ||
val snapshotsRepoUrl = uri(layout.buildDirectory.dir("repos/snapshots")) | ||
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl | ||
} | ||
|
||
maven { | ||
name = "GitHubPackages" | ||
url = uri("https://maven.pkg.github.com/inngest/inngest-kt") | ||
credentials { | ||
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR") | ||
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN") | ||
username = System.getenv("GITHUB_ACTOR") | ||
password = System.getenv("GITHUB_TOKEN") | ||
} | ||
} | ||
} | ||
publications { | ||
register<MavenPublication>("gpr") { | ||
register<MavenPublication>("inngest-spring-boot-adapter") { | ||
from(components["java"]) | ||
|
||
pom { | ||
name.set(project.name) | ||
description.set("Inngest SDK for Kotlin/Java") | ||
url.set("https://github.com/inngest/inngest-kt") | ||
inceptionYear.set("2024") | ||
|
||
licenses { | ||
license { | ||
name.set("The Apache License, Version 2.0") | ||
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id.set("eng") | ||
name.set("Inngest Engineering") | ||
email.set("[email protected]") | ||
} | ||
} | ||
|
||
scm { | ||
url.set("https://github.com/inngest/inngest-kt") | ||
connection.set("scm:git:https://github.com/inngest/inngest-kt.git") | ||
developerConnection.set("scm:git:[email protected]:inngest/inngest-kt.git") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
val signingKey = System.getenv("GPG_SIGNING_KEY") | ||
val signingPasswd = System.getenv("GPG_SIGNING_KEY_PASSWORD") | ||
useInMemoryPgpKeys(signingKey, signingPasswd) | ||
sign(publishing.publications) | ||
} | ||
|
||
tasks.jar { | ||
manifest { | ||
attributes( | ||
mapOf( | ||
"Implementation-Title" to project.name, | ||
"Implementation-Version" to project.version, | ||
), | ||
) | ||
} | ||
} | ||
|
||
tasks.javadoc { | ||
if (JavaVersion.current().isJava9Compatible) { | ||
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true) | ||
} | ||
} | ||
|
||
tasks.withType<Test> { | ||
useJUnitPlatform() | ||
|
||
testLogging { | ||
events = | ||
setOf( | ||
TestLogEvent.FAILED, | ||
TestLogEvent.PASSED, | ||
TestLogEvent.SKIPPED, | ||
) | ||
|
||
exceptionFormat = TestExceptionFormat.FULL | ||
showStandardStreams = true | ||
showExceptions = true | ||
showCauses = true | ||
showStackTraces = true | ||
|
||
// set options for log level DEBUG and INFO | ||
debug { | ||
events = | ||
setOf( | ||
TestLogEvent.STARTED, | ||
TestLogEvent.FAILED, | ||
TestLogEvent.PASSED, | ||
TestLogEvent.SKIPPED, | ||
TestLogEvent.STANDARD_ERROR, | ||
TestLogEvent.STANDARD_OUT, | ||
) | ||
|
||
exceptionFormat = TestExceptionFormat.FULL | ||
} | ||
|
||
info.events = debug.events | ||
info.exceptionFormat = debug.exceptionFormat | ||
|
||
afterSuite( | ||
KotlinClosure2({ desc: TestDescriptor, result: TestResult -> | ||
if (desc.parent == null) { // will match the outermost suite | ||
println( | ||
"Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)", | ||
) | ||
} | ||
}), | ||
) | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
RELEASES=build/repos/releases/com | ||
ASSEMBLE=$(mktemp -d) | ||
cp -R $RELEASES $ASSEMBLE | ||
|
||
# Enter temp dir | ||
pushd $ASSEMBLE | ||
|
||
rm com/inngest/inngest-spring-boot-adapter/maven-* | ||
zip -r bundle.zip com | ||
|
||
popd | ||
|
||
cp $ASSEMBLE/bundle.zip . | ||
|
||
rm -rf $ASSEMBLE |