From c199c7be0f9179027a22a61c9482a3bb9aa5bb37 Mon Sep 17 00:00:00 2001
From: lewa <lene.wasskog@nibio.no>
Date: Mon, 4 Sep 2023 08:51:46 +0200
Subject: [PATCH] build: Make deploy job in main branch fail with exit code 1
 if version is not SNAPSHOT

---
 .gitlab-ci.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4f58ff4..9aead42 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -36,6 +36,8 @@ test:
 deploy-snapshot:
   stage: deploy
   script:
+    - export VERSION=$(./mvnw --batch-mode --no-transfer-progress --non-recursive help:evaluate -Dexpression=project.version | grep -v "\[.*")
+    - if ! [[ $VERSION =~ .*SNAPSHOT ]]; then exit 1; fi
     - ./mvnw $MAVEN_CLI_OPTS $MAVEN_OPTS deploy -DskipTests
   tags:
     - vips-java
-- 
GitLab