From e7baa69822d4bb824497a8aa06cdf084ee10a19b Mon Sep 17 00:00:00 2001
From: lewa <lene.wasskog@nibio.no>
Date: Mon, 4 Sep 2023 08:28:50 +0200
Subject: [PATCH] build: Prevent deploy from main branch 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 49a2c7e..935c5d4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -49,6 +49,8 @@ test_after_vips_common_changes:
 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 0; fi
     - ./mvnw $MAVEN_CLI_OPTS $MAVEN_OPTS deploy -DskipTests
   tags:
     - vips-java
-- 
GitLab