diff --git a/nix/scripts/deploy.nix b/nix/scripts/deploy.nix index 0bd6e8d7dde9fb4d77fa8d798df0a5372c6f1548..b1578052aff82a16dfffafb979b632e09382a582 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." ''