Skip to content

Commit 69b376d

Browse files
committed
Add signing and upload
1 parent a140f3c commit 69b376d

File tree

2 files changed

+89
-2
lines changed

2 files changed

+89
-2
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,13 @@ jobs:
3939
uses: actions/upload-artifact@v3
4040
with:
4141
name: Plugin Debug Archive
42-
path: build/libs/plugin-debug-*.jar
42+
path: build/libs/plugin-debug-*.jar
43+
- name: Publish package
44+
uses: gradle/gradle-build-action@v2
45+
with:
46+
arguments: publishMavenJavaPublicationToMavenRepository
47+
env:
48+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
49+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
50+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_SECRET }}
51+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PGP_PASSPHRASE }}

build.gradle.kts

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ plugins {
55
kotlin("jvm") version "1.8.20"
66
id("org.ajoberstar.grgit") version "5.2.0"
77
`java-library`
8+
`maven-publish`
9+
signing
10+
id("org.jetbrains.dokka") version "1.8.10"
811
}
912

1013
if (!File("$rootDir/.git").exists()) {
@@ -60,4 +63,79 @@ kotlin {
6063
languageVersion = "2.0"
6164
}
6265
}
63-
}
66+
}
67+
68+
val sourceJar by tasks.register<Jar>("kotlinJar") {
69+
from(sourceSets.main.get().allSource)
70+
archiveClassifier.set("sources")
71+
}
72+
val dokkaJavadocJar by tasks.register<Jar>("dokkaHtmlJar") {
73+
dependsOn(rootProject.tasks.dokkaHtml)
74+
from(rootProject.tasks.dokkaHtml.flatMap { it.outputDirectory })
75+
archiveClassifier.set("html-docs")
76+
}
77+
78+
val dokkaHtmlJar by tasks.register<Jar>("dokkaJavadocJar") {
79+
dependsOn(rootProject.tasks.dokkaJavadoc)
80+
from(rootProject.tasks.dokkaJavadoc.flatMap { it.outputDirectory })
81+
archiveClassifier.set("javadoc")
82+
}
83+
84+
publishing {
85+
publications {
86+
create<MavenPublication>("mavenJava") {
87+
from(components.findByName("java"))
88+
groupId = "dev.themeinerlp"
89+
artifactId = "plugin-debug"
90+
version = rootProject.version.toString()
91+
artifact(dokkaJavadocJar)
92+
artifact(dokkaHtmlJar)
93+
artifact(sourceJar)
94+
pom {
95+
name.set("Plugin debug")
96+
description.set("A simple library to upload plugin debugs")
97+
url.set("https://github.com/OneLiteFeatherNET/Plugin-Debug")
98+
licenses {
99+
license {
100+
name.set("AGPL-3.0")
101+
url.set("https://github.com/OneLiteFeatherNET/Plugin-Debug/blob/main/LICENSE")
102+
}
103+
}
104+
issueManagement {
105+
system.set("Github")
106+
url.set("https://github.com/OneLiteFeatherNET/Plugin-Debug/issues")
107+
}
108+
developers {
109+
developer {
110+
id.set("TheMeinerLP")
111+
name.set("Phillipp Glanz")
112+
email.set("[email protected]")
113+
}
114+
}
115+
scm {
116+
connection.set("scm:[email protected]:OneLiteFeatherNET/Plugin-Debug.git")
117+
developerConnection.set("scm:[email protected]:OneLiteFeatherNET/Plugin-Debug.git")
118+
url.set("https://github.com/OneLiteFeatherNET/Plugin-Debug")
119+
}
120+
}
121+
}
122+
}
123+
repositories {
124+
maven {
125+
val releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
126+
val snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
127+
url = if (version.toString().contains("SNAPSHOT")) uri(snapshotsRepoUrl) else uri(releasesRepoUrl)
128+
credentials {
129+
username = System.getenv("OSSRH_USERNAME")
130+
password = System.getenv("OSSRH_PASSWORD")
131+
}
132+
}
133+
}
134+
}
135+
136+
signing {
137+
val signingKey: String? by project
138+
val signingPassword: String? by project
139+
useInMemoryPgpKeys(signingKey, signingPassword)
140+
sign(publishing.publications)
141+
}

0 commit comments

Comments
 (0)