-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adapt workflow and build script in order to deploy on maven central (#76
) The purpose of the pull request is to switch deployment of t2iapi (java part) from github packages to maven central. # Checklist The following aspects have been respected by the author of this pull request, confirmed by both pull request assignee **and** reviewer: * Changelog update (necessity checked and entry added or not added respectively) * [X] Pull Request Assignee * [x] Reviewer * README update (necessity checked and entry added or not added respectively) * [X] Pull Request Assignee * [x] Reviewer --------- Co-authored-by: Staeck, Philipp <[email protected]>
- Loading branch information
Showing
3 changed files
with
74 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ plugins { | |
`maven-publish` | ||
id("com.google.protobuf") version "0.9.1" | ||
id("com.google.osdetector") version "1.7.1" | ||
signing | ||
} | ||
|
||
val configFile = File("../config/versions.txt").readLines() | ||
|
@@ -14,9 +15,10 @@ val protocVersion = configFileMap["JAVA_PROTOC_VERSION"] | |
val grpcVersion = configFileMap["JAVA_GRPC_VERSION"] | ||
val baseVersion = configFileMap["BASE_PACKAGE_VERSION"]!! | ||
val buildId: String? = System.getenv("GITHUB_RUN_NUMBER") | ||
val t2iapiVersion: String = when (System.getenv("RELEASE_VERSION") == "1") { | ||
val isRelease = System.getenv("RELEASE_VERSION") == "1" | ||
val t2iapiVersion: String = when (isRelease) { | ||
true -> baseVersion | ||
false -> baseVersion + ( buildId?.let { ".$it" } ?: "" ) | ||
false -> baseVersion + ( buildId?.let { ".$it" } ?: "" ) + "-SNAPSHOT" | ||
} | ||
|
||
version = t2iapiVersion | ||
|
@@ -44,6 +46,11 @@ tasks.compileJava { | |
targetCompatibility = "11" | ||
} | ||
|
||
java { | ||
withJavadocJar() | ||
withSourcesJar() | ||
} | ||
|
||
protobuf { | ||
protoc { | ||
// The artifact spec for the Protobuf Compiler | ||
|
@@ -74,6 +81,26 @@ publishing { | |
from(components["java"]) | ||
pom { | ||
name.set("test 2 interface api") | ||
url.set("https://github.com/Draegerwerk/t2iapi") | ||
description.set( | ||
"t2iapi describes a product-independent interface to manipulate devices which utilize" + | ||
" ISO/IEEE 11073 SDC during verification." | ||
) | ||
|
||
scm { | ||
connection.set("scm:git:git://github.com/Draegerwerk/t2iapi.git") | ||
developerConnection.set("scm:git:ssh://github.com/Draegerwerk/t2iapi.git") | ||
url.set("https://github.com/Draegerwerk/t2iapi") | ||
} | ||
|
||
developers { | ||
developer { | ||
id.set("t2i") | ||
name.set("T2I Team") | ||
email.set("[email protected]") | ||
} | ||
} | ||
|
||
licenses { | ||
license { | ||
name.set("MIT License") | ||
|
@@ -86,12 +113,27 @@ publishing { | |
|
||
repositories { | ||
maven { | ||
name = "GitHubPackages" | ||
url = uri("https://maven.pkg.github.com/Draegerwerk/t2iapi") | ||
name = "Sonatype" | ||
|
||
val releaseUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
val snapshotsUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" | ||
|
||
url = uri(if (isRelease) releaseUrl else snapshotsUrl) | ||
credentials { | ||
username = System.getenv("GITHUB_ACTOR") | ||
password = System.getenv("GITHUB_TOKEN") | ||
username = System.getenv("MAVEN_USERNAME") | ||
password = System.getenv("MAVEN_PASSWORD") | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
useInMemoryPgpKeys(System.getenv("MAVEN_GPG_PRIVATE_KEY"), System.getenv("MAVEN_GPG_PASSPHRASE")) | ||
sign(publishing.publications["maven"]) | ||
} | ||
|
||
tasks.javadoc { | ||
if (JavaVersion.current().isJava9Compatible) { | ||
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true) | ||
} | ||
} |
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