From 8495a6d5b7ba9275635ed899308c8bac615cc2fb Mon Sep 17 00:00:00 2001
From: Volker Schukai <volker.schukai@schukai.com>
Date: Sun, 23 Jun 2024 17:17:46 +0200
Subject: [PATCH] fix: wip pipeline

---
 .gitlab-ci.yml         | 3 +--
 CHANGELOG.md           | 4 ----
 nix/scripts/deploy.nix | 9 ++++++++-
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5807cec32..f23e4624a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -63,8 +63,7 @@ release:
     - nix develop .#gitlab --command release
   when: on_success
   rules:
-    - if: $DEPLOY_VERSION == null
-    - if: $CI_COMMIT_BRANCH == "master"
+    - if: $DEPLOY_VERSION == null && $CI_COMMIT_BRANCH == "master"
       
 deploy:
   stage: deploy
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 446ae6b6a..e1f927137 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,15 +1,11 @@
 # Changelog
 
-
-
 ## [3.68.0] - 2024-06-23
 
 ### Add Features
 
 - add on/off action to toggle switch [#207](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/207)
-### Bug Fixes
 
-- gitlab pipeline
 ### Changes
 
 - repair toggle test
diff --git a/nix/scripts/deploy.nix b/nix/scripts/deploy.nix
index 506e9d0aa..48db12419 100644
--- a/nix/scripts/deploy.nix
+++ b/nix/scripts/deploy.nix
@@ -17,7 +17,7 @@ in
     archive=$(ls ${monster} | grep tgz)
 
     echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
-    if ! publishingResult=$(${pkgs'.nodejs_20}/bin/npm publish "${monster}/$archive" --no-git-checks --access public)
+    if ! publishingResult=$(${pkgs'.nodejs_20}/bin/npm publish "${monster}/$archive" --json --no-git-checks --access public)
     then
       if [ -f .npmrc ] ; then rm .npmrc ; fi
       echo_fail "Failed to publish the project."
@@ -33,6 +33,13 @@ in
     echo_hint "Version $(echo $publishingResult | jq .version)"
     echo_hint "SHA Sum: $(echo $publishingResult | jq .shasum)"
     echo_hint "Files: $(echo $publishingResult | jq .entryCount)"
+set -x     
+    if [ "$(echo $publishingResult | jq .id)" == null ] ; then
+      echo_fail "Failed to publish the project."
+      ${pkgs'.curl}/bin/curl --header "Content-Type: application/json" --request POST \
+                --data '{"text":"Failed to publish: '$(echo $publishingResult | jq .name)' '$(echo $publishingResult | jq .version)'"}' $MATTERMOST_WEBHOOK
+      exit 1
+    fi
     
     ${pkgs'.curl}/bin/curl --header "Content-Type: application/json" --request POST \
               --data '{"text":"Deployed: '$(echo $publishingResult | jq .name)' '$(echo $publishingResult | jq .version)'"}' $MATTERMOST_WEBHOOK
-- 
GitLab