This is an automated email from the ASF dual-hosted git repository.

mdedetrich pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-pekko-grpc.git


The following commit(s) were added to refs/heads/main by this push:
     new 733535fb Log incase of missing environment variables
733535fb is described below

commit 733535fb67e41f9dffa0cea95de494007c5d0da0
Author: Matthew de Detrich <[email protected]>
AuthorDate: Mon Aug 7 16:17:47 2023 +0200

    Log incase of missing environment variables
---
 .github/workflows/publish-nightly.yml |  4 ++--
 gradle-plugin/build.gradle            | 19 +++++++++++++++----
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/publish-nightly.yml 
b/.github/workflows/publish-nightly.yml
index 120ed95a..ce010fdd 100644
--- a/.github/workflows/publish-nightly.yml
+++ b/.github/workflows/publish-nightly.yml
@@ -31,8 +31,8 @@ jobs:
           NEXUS_USER: ${{ secrets.NEXUS_USER }}
           NEXUS_PW: ${{ secrets.NEXUS_PW }}
 
-      - name: Publish Plugin to Gradle Plugin Repository
-        run: cd gradle-plugin && ./gradlew publishToSonatype
+      - name: Publish Gradle Plugin to Apache Nexus Repository
+        run: cd gradle-plugin && ./gradlew properties -q | awk '/^version:/ 
{print $2}' && ./gradlew publishToSonatype
         env:
           NEXUS_USER: ${{ secrets.NEXUS_USER }}
           NEXUS_PW: ${{ secrets.NEXUS_PW }}
diff --git a/gradle-plugin/build.gradle b/gradle-plugin/build.gradle
index 12208a6e..52829982 100644
--- a/gradle-plugin/build.gradle
+++ b/gradle-plugin/build.gradle
@@ -51,13 +51,24 @@ publishing {
     }
 }
 
+def getEnvVariable(String envVariableName) {
+    String envVariableValue = System.getenv(envVariableName)
+    if (envVariableValue == null)
+        project.logger.error("${envVariableName} is null")
+    else if (envVariableValue.isEmpty())
+        project.logger.error("${envVariableName} is is empty")
+    else if (envVariableValue.isBlank())
+        project.logger.error("${envVariableName} is is blank")
+    return envVariableValue
+}
+
 nexusPublishing {
     repositories {
         sonatype {
-            nexusUrl.set(uri("https://repository.apache.org/service/local/";))
-            
snapshotRepositoryUrl.set(uri("https://repository.apache.org/content/repositories/snapshots/";))
-            username = System.getenv("NEXUS_USER")
-            password = System.getenv("NEXUS_PW")
+            nexusUrl = uri("https://repository.apache.org/service/local/";)
+            snapshotRepositoryUrl = 
uri("https://repository.apache.org/content/repositories/snapshots/";)
+            username = getEnvVariable("NEXUS_USER")
+            password = getEnvVariable("NEXUS_PW")
         }
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to