From e568c975d5b74595335f637b9520cf69d4ae9a28 Mon Sep 17 00:00:00 2001
From: lewa <lene.wasskog@nibio.no>
Date: Wed, 10 Jan 2024 12:53:34 +0100
Subject: [PATCH] chore: Fix if statement

---
 .gitlab-ci.yml | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 134edd4..14f0c91 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -81,9 +81,12 @@ build-for-production:
       fi
     # If release tag does not already exist, commit and push pom with new version
     - git add pom.xml
-    # Check if there are any changes staged for commit
-    - if ! git diff --cached --quiet; then
-      git commit -m "[ci skip] Set release version ${RELEASE_VERSION}"; git push origin $RELEASE_BRANCH
+    - |
+      if git diff --cached --quiet -- pom.xml; then
+          echo "No changes to commit for pom.xml, skipping commit and push"
+      else
+          git commit -m "[ci skip] Set release version ${RELEASE_VERSION}"
+          git push origin $RELEASE_BRANCH
       fi
     # Build new war file
     - echo "Build war file with version '$RELEASE_VERSION'"
-- 
GitLab