Skip to content

Commit

Permalink
Release
Browse files Browse the repository at this point in the history
Add publishing plugin
Add signing plugin

Generate sources and javadocs jars (but they can bt empty)
Describe hot to set up plugins and prolong keys.
Remove "-gradle-plugin" from plugin id.
Made first publishing to Maven Central
  • Loading branch information
Ravil Galeyev committed Oct 9, 2022
1 parent 89143ea commit c42f8b7
Show file tree
Hide file tree
Showing 6 changed files with 301 additions and 28 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.idea
.gradle
build
gradle/wrapper
gradle/wrapper
gradle.properties
publish.log
86 changes: 83 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@ plugins {
id("org.jetbrains.kotlin.jvm").version("1.5.31")
id("java-gradle-plugin")
id("maven-publish")
signing
}

group = "me.dehasi"
version = "LATEST-SNAPSHOT"

val isPublishing = project.hasProperty("releaseVersion")
if (isPublishing) {
project.version = project.property("releaseVersion").toString()
} else {
project.version = "LATEST-SNAPSHOT"
}

java {
sourceCompatibility = JavaVersion.VERSION_17
Expand All @@ -25,11 +32,16 @@ dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-params:5.9.0")
}

val pluginName = "Jenkins Pipeline Linter Gradle Plugin"
val pluginDescription = "A plugin to lint jenkins pipelines."

gradlePlugin {
plugins {
create("jenkins-pipeline-linter-gradle-plugin") {
id = "me.dehasi.jenkins-pipeline-linter-gradle-plugin"
create("jenkins-pipeline-linter") {
id = "me.dehasi.jenkins-pipeline-linter"
implementationClass = "me.dehasi.jenkins.linter.LinterPlugin"
description = pluginDescription
displayName = pluginName
}
}
}
Expand All @@ -39,3 +51,71 @@ tasks {
useJUnitPlatform()
}
}

val javadocJar: TaskProvider<Jar> by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
}

val sourcesJar: TaskProvider<Jar> by tasks.registering(Jar::class) {
archiveClassifier.set("sources")
}

publishing {
publications.withType<MavenPublication> {
artifact(javadocJar)
artifact(sourcesJar)

repositories {
maven {
name = "OSSRH"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
credentials {
username = project.property("ossrhUsername").toString()
password = project.property("ossrhPassword").toString()
}
}
}
groupId = "me.dehasi"
artifactId = "jenkins-pipeline-linter-gradle-plugin"
version = project.version.toString()

pom {
val projectGitHubUrl = "https://github.com/dehasi/jenkins-pipeline-linter-gradle-plugin"

name.set(pluginName)
description.set(pluginDescription)
url.set(projectGitHubUrl)
inceptionYear.set("2022")

scm {
connection.set("scm:git:$projectGitHubUrl")
developerConnection.set("scm:git:$projectGitHubUrl")
url.set(projectGitHubUrl)
}
licenses {
license {
name.set("MIT")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set("dehasi")
name.set("Ravil")
email.set("dehasi@proton.me")
url.set("http://dehasi.me")
}
}
issueManagement {
system.set("GitHub")
url.set("$projectGitHubUrl/issues")
}
}
the<SigningExtension>().sign(this)
}
}

signing {
isRequired = isPublishing
sign(configurations.archives.get())
}
Loading

0 comments on commit c42f8b7

Please sign in to comment.