diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 78920f7..abee20a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,6 +37,5 @@ jobs: env: ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.CENTRAL_TOKEN_USERNAME || secrets.SONATYPE_USERNAME }} ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.CENTRAL_TOKEN_PASSWORD || secrets.SONATYPE_PASSWORD }} - ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} run: ./gradlew gitPublishPush publishAndReleaseToMavenCentral -Pversion=${{ steps.version.outputs.tag }} -Prelease=true -Dorg.ajoberstar.grgit.auth.username=${{ secrets.GH_PAGES_TOKEN }} --stacktrace diff --git a/build.gradle b/build.gradle index f52bf4a..cccec1e 100644 --- a/build.gradle +++ b/build.gradle @@ -169,9 +169,30 @@ subprojects { subproject -> developerConnection = "scm:git:ssh://git@github.com/${slug}.git" } } + } + afterEvaluate { if (rootProject.config.release) { - signAllPublications() + apply plugin: 'signing' + + signing { + String signingKey = findProperty('signingInMemoryKey') + if (signingKey) { + useInMemoryPgpKeys( + signingKey, + (findProperty('signingInMemoryKeyPassword') ?: '') as String + ) + } + + sign publishing.publications + required = true + } + + tasks.withType(org.gradle.plugins.signing.Sign).configureEach { + required = true + signatory = signing.signatory + setOnlyIf { true } + } } }