From 292568980a98a7abc0092f04f10979e922010fde Mon Sep 17 00:00:00 2001 From: Darren Reid Date: Thu, 12 Oct 2023 13:26:12 +1100 Subject: [PATCH] Use environment variables to assign signatory details. --- .github/workflows/publish-android-maven-central.yml | 4 ++-- .github/workflows/publish-client-maven-central.yml | 4 ++-- src/AndroidClient/android/build.gradle | 11 ++++++----- src/AndroidClient/client/build.gradle | 11 +++++++---- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish-android-maven-central.yml b/.github/workflows/publish-android-maven-central.yml index 4a55500..435b86e 100644 --- a/.github/workflows/publish-android-maven-central.yml +++ b/.github/workflows/publish-android-maven-central.yml @@ -40,7 +40,7 @@ jobs: env: OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} - ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} - ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSSRH_GPG_KEY }} + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} working-directory: ./src/AndroidClient run: ./gradlew android:publishAllPublicationsToOSSRHRepository diff --git a/.github/workflows/publish-client-maven-central.yml b/.github/workflows/publish-client-maven-central.yml index af54621..a7586f1 100644 --- a/.github/workflows/publish-client-maven-central.yml +++ b/.github/workflows/publish-client-maven-central.yml @@ -40,7 +40,7 @@ jobs: env: OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} - ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} - ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSSRH_GPG_KEY }} + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} working-directory: ./src/AndroidClient run: ./gradlew client:publishAllPublicationsToOSSRHRepository diff --git a/src/AndroidClient/android/build.gradle b/src/AndroidClient/android/build.gradle index 0b94a57..374f9f3 100644 --- a/src/AndroidClient/android/build.gradle +++ b/src/AndroidClient/android/build.gradle @@ -116,14 +116,15 @@ publishing { } } +// Check if the environment variables are set +def signingKey = System.getenv('SIGNING_KEY') +def signingPassword = System.getenv('SIGNING_PASSWORD') - -if (findProperty('signingKeyId')) { +// Conditionally apply the signing plugin and configuration +if (signingKey && signingPassword) { println "Signing enabled" signing { - def signingKeyId = findProperty("signingKeyId") - def signingKey = findProperty("signingKey") - useInMemoryPgpKeys(signingKeyId, signingKey, null) + useInMemoryPgpKeys(signingKey, signingPassword) sign publishing.publications.mavenJava } } else { diff --git a/src/AndroidClient/client/build.gradle b/src/AndroidClient/client/build.gradle index 36566c6..63eb666 100644 --- a/src/AndroidClient/client/build.gradle +++ b/src/AndroidClient/client/build.gradle @@ -104,12 +104,15 @@ publishing { } } -if (findProperty('signingKeyId')) { +// Check if the environment variables are set +def signingKey = System.getenv('SIGNING_KEY') +def signingPassword = System.getenv('SIGNING_PASSWORD') + +// Conditionally apply the signing plugin and configuration +if (signingKey && signingPassword) { println "Signing enabled" signing { - def signingKeyId = findProperty("signingKeyId") - def signingKey = findProperty("signingKey") - useInMemoryPgpKeys(signingKeyId, signingKey, null) + useInMemoryPgpKeys(signingKey, signingPassword) sign publishing.publications.mavenJava } } else {