From 2701919f66b8846f055cbea3dd98ba3184839eee Mon Sep 17 00:00:00 2001
From: Volker Schukai <volker.schukai@schukai.com>
Date: Thu, 1 Aug 2024 22:29:10 +0200
Subject: [PATCH] fix: test pipeline

---
 nix/scripts/deploy.nix | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/nix/scripts/deploy.nix b/nix/scripts/deploy.nix
index 0bd6e8d7d..b1578052a 100644
--- a/nix/scripts/deploy.nix
+++ b/nix/scripts/deploy.nix
@@ -37,25 +37,28 @@ in
     if [ "$(echo $publishingResult | jq .id)" == null ] ; then
       echo_fail "Failed to publish the project."
 
-      json=$(jq -n \
-                  --arg name "$(echo $publishingResult | jq -r .name)" \
-                  --arg version "$(echo $publishingResult | jq -r .version)" \
+      json=$(${pkgs'.jq}/bin/jq -n \
+                  --arg name "$(echo $publishingResult | ${pkgs'.jq}/bin/jq -r .name)" \
+                  --arg version "$(echo $publishingResult | ${pkgs'.jq}/bin/jq -r .version)" \
                   '{text: ("Oh no, we failed to publish the " + $version + " version of " + $name + " :x:")}')
 
       ${pkgs'.curl}/bin/curl --header "Content-Type: application/json" --request POST \
                    --data "$json" $MATTERMOST_WEBHOOK
 
-
       exit 1
     fi
 
-    json=$(jq -n \
-              --arg name "$(echo $publishingResult | jq -r .name)" \
-              --arg version "$(echo $publishingResult | jq -r .version)" \
-              '{icon_emoji: ":monster:", text: ("We have just launched the " + $version + " version of " + $name + "! Give it a try. :rocket:")}')
-
-    ${pkgs'.curl}/bin/curl --header "Content-Type: application/json" --request POST \
-               --data "$json" $MATTERMOST_WEBHOOK
+    if [[ -n "$MATTERMOST_WEBHOOK" ]]; then
+    
+        json=$(${pkgs'.jq}/bin/jq -n \
+                  --arg name "$(echo $publishingResult | ${pkgs'.jq}/bin/jq -r .name)" \
+                  --arg version "$(echo $publishingResult | ${pkgs'.jq}/bin/jq -r .version)" \
+                  '{icon_emoji: ":monster:", text: ("We have just launched the " + $version + " version of " + $name + "! Give it a try. :rocket:")}')
+    
+        ${pkgs'.curl}/bin/curl --header "Content-Type: application/json" --request POST \
+                   --data "$json" $MATTERMOST_WEBHOOK
+                   
+    fi
 
     echo_ok "Build and publish successful."
   ''
-- 
GitLab