From f124f6f9a6d940dc9c31ea1fee749ebc84187a6a Mon Sep 17 00:00:00 2001 From: Sam Hill Date: Fri, 7 Jun 2024 15:38:27 -0400 Subject: [PATCH] Dont sign test builds (#398) * Don't sign the local publish in tests * Update workflow --- .github/workflows/build.yml | 4 +--- gradle/gradle-mvn-mpp-push.gradle | 8 +++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9c8fc2da..1b2b39de 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,10 +62,8 @@ jobs: CI: "true" - name: Local Publish For Samples if: matrix.os == 'macOS-latest' - run: ./gradlew publishToMavenLocal --no-daemon --stacktrace --build-cache + run: ./gradlew publishToMavenLocal --no-daemon --stacktrace --build-cache -PRELEASE_SIGNING_ENABLED=false env: - ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} S3_BUILD_CACHE_AWS_REGION: ${{ secrets.S3_BUILD_CACHE_AWS_REGION }} S3_BUILD_CACHE_BUCKET_NAME: ${{ secrets.S3_BUILD_CACHE_BUCKET_NAME }} S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }} diff --git a/gradle/gradle-mvn-mpp-push.gradle b/gradle/gradle-mvn-mpp-push.gradle index 420c0686..cbd19ed4 100644 --- a/gradle/gradle-mvn-mpp-push.gradle +++ b/gradle/gradle-mvn-mpp-push.gradle @@ -19,10 +19,16 @@ def getAwsSecretKey() { return hasProperty('AWS_SECRET_KEY') ? AWS_SECRET_KEY : "" } + def isReleaseBuild() { return VERSION_NAME.contains("SNAPSHOT") == false } +def releaseSigningRequired() { + def enabled = hasProperty('RELEASE_SIGNING_ENABLED') ? RELEASE_SIGNING_ENABLED : false + return isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") && enabled +} + def getReleaseRepositoryUrl() { return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" @@ -53,7 +59,7 @@ def getGpgKey() { } signing { - required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } + required { releaseSigningRequired() } def gpgKey = getGpgKey() if(gpgKey != "") { useInMemoryPgpKeys(getGpgKey(), "")