Skip to content

Commit

Permalink
Hopefully fix signing
Browse files Browse the repository at this point in the history
  • Loading branch information
ThexXTURBOXx committed Dec 5, 2023
1 parent d4dd9e6 commit 9056e6c
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ nexusPublishing {
subprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'signing'

java {
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -72,6 +73,15 @@ subprojects {
// Cache list of tasks
project.getAllTasks(true)

signing {
var signingKey = providers.environmentVariable("GPG_SIGNING_KEY")
var signingPassphrase = providers.environmentVariable("GPG_SIGNING_PASSPHRASE")
if (signingKey.present && signingPassphrase.present) {
useInMemoryPgpKeys(signingKey.get(), signingPassphrase.get())
sign publishing.publications
}
}

publishing {
publications {
mavenJava(MavenPublication) {
Expand All @@ -80,8 +90,11 @@ subprojects {
version = project.version.toString()
if (tasks.findByName("shadowJar") == null)
from(components.java)
else
artifact(tasks.findByName("shadowJar"))
else {
artifact(tasks.named("shadowJar"))
artifact(tasks.named("sourcesJar"))
artifact(tasks.named("javadocJar"))
}
pom {
name.set(project.name)
description.set(Meta.desc)
Expand Down Expand Up @@ -121,17 +134,6 @@ subprojects {
}
}

signing {
var signingKey = providers.environmentVariable("GPG_SIGNING_KEY")
var signingPassphrase = providers.environmentVariable("GPG_SIGNING_PASSPHRASE")
if (signingKey.present && signingPassphrase.present) {
useInMemoryPgpKeys(signingKey.get(), signingPassphrase.get())
sign(publishing.publications)
}
}

// ./gradlew publish closeAndReleaseStagingRepository

// Workaround for https://github.com/gradle/gradle/issues/820
configurations {
api {
Expand Down

0 comments on commit 9056e6c

Please sign in to comment.