-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
70 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,85 @@ | ||
plugins { | ||
`maven-publish` | ||
signing | ||
java | ||
`maven-publish` | ||
signing | ||
java | ||
} | ||
fun getProperty( | ||
projectKey: String, | ||
environmentKey: String | ||
projectKey: String, | ||
environmentKey: String | ||
): String? { | ||
return if (project.hasProperty(projectKey)) { | ||
project.property(projectKey) as? String? | ||
} else { | ||
System.getenv(environmentKey) | ||
} | ||
return if (project.hasProperty(projectKey)) { | ||
project.property(projectKey) as? String? | ||
} else { | ||
System.getenv(environmentKey) | ||
} | ||
} | ||
|
||
publishing { | ||
publications { | ||
create<MavenPublication>("publish-${project.name}") { | ||
groupId = rootProject.group.toString() | ||
version = rootProject.version.toString() | ||
artifactId = project.name | ||
from(components["java"]) | ||
pom { | ||
name.set(project.name) | ||
description.set(project.properties["projectDescription"].toString()) | ||
url.set(project.properties["projectUrl"].toString()) | ||
packaging = "jar" | ||
licenses { | ||
license { | ||
name.set(project.properties["licence"].toString()) | ||
url.set(project.properties["licenceUrl"].toString()) | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("osoykan") | ||
name.set("Oguzhan Soykan") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
connection.set("scm:[email protected]:Trendyol/stove.git") | ||
developerConnection.set("scm:git:ssh://github.com:Trendyol/stove.git") | ||
url.set(project.properties["projectUrl"].toString()) | ||
} | ||
} | ||
publications { | ||
create<MavenPublication>("publish-${project.name}") { | ||
groupId = rootProject.group.toString() | ||
version = rootProject.version.toString() | ||
artifactId = project.name | ||
from(components["java"]) | ||
pom { | ||
name.set(project.name) | ||
description.set(project.properties["projectDescription"].toString()) | ||
url.set(project.properties["projectUrl"].toString()) | ||
packaging = "jar" | ||
licenses { | ||
license { | ||
name.set(project.properties["licence"].toString()) | ||
url.set(project.properties["licenceUrl"].toString()) | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("osoykan") | ||
name.set("Oguzhan Soykan") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
connection.set("scm:[email protected]:Trendyol/stove.git") | ||
developerConnection.set("scm:git:ssh://github.com:Trendyol/stove.git") | ||
url.set(project.properties["projectUrl"].toString()) | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") | ||
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/") | ||
url = if (rootProject.version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl | ||
// url = rootProject.buildDir.resolve("publications").toURI() | ||
credentials { | ||
username = getProperty("nexus_username", "nexus_username") | ||
password = getProperty("nexus_password", "nexus_password") | ||
} | ||
} | ||
repositories { | ||
maven { | ||
val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") | ||
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/") | ||
url = if (rootProject.version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl | ||
// url = rootProject.buildDir.resolve("publications").toURI() | ||
credentials { | ||
username = getProperty("nexus_username", "nexus_username") | ||
password = getProperty("nexus_password", "nexus_password") | ||
} | ||
} | ||
maven { | ||
name = "GitHubPackages" | ||
url = uri("https://maven.pkg.github.com/trendyol/stove") | ||
credentials { | ||
username = "trendyol-bot" | ||
password = getProperty("BOT_REPO_TOKEN", "BOT_REPO_TOKEN") | ||
} | ||
} | ||
} | ||
} | ||
|
||
val signingKey = getProperty(projectKey = "gpg.key", environmentKey = "gpg_private_key") | ||
val passPhrase = getProperty(projectKey = "gpg.passphrase", environmentKey = "gpg_passphrase") | ||
signing { | ||
if (passPhrase == null) { | ||
logger.warn( | ||
"The passphrase for the signing key was not found. " + | ||
"Either provide it as env variable 'gpg_passphrase' or " + | ||
"as project property 'gpg_passphrase'. Otherwise the signing might fail!" | ||
) | ||
} | ||
useInMemoryPgpKeys(signingKey, passPhrase) | ||
sign(publishing.publications) | ||
if (passPhrase == null) { | ||
logger.warn( | ||
"The passphrase for the signing key was not found. " + | ||
"Either provide it as env variable 'gpg_passphrase' or " + | ||
"as project property 'gpg_passphrase'. Otherwise the signing might fail!" | ||
) | ||
} | ||
useInMemoryPgpKeys(signingKey, passPhrase) | ||
sign(publishing.publications) | ||
} |