From 3db3adf0d6ef04b8084e6798f11db3ec5ecbd12a Mon Sep 17 00:00:00 2001
From: Jan Zickermann <jan.zickermann@dataport.de>
Date: Mon, 4 Nov 2024 15:42:29 +0100
Subject: [PATCH] #1 Publish snapshot only on main branch

---
 .gitlab-ci.yml | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8e3d46a..2734658 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -19,27 +19,40 @@ cache:
 
 stages:
   - build
+  - test
   - publish
 
-verify:
+build:
   stage: build
   script:
-    - echo "mvn verify $MAVEN_CLI_OPTS"
-    - mvn help:effective-settings $MAVEN_CLI_OPTS
-    - mvn verify $MAVEN_CLI_OPTS
+    - mvn compile $MAVEN_CLI_OPTS
   artifacts:
     paths:
       - target/*.jar
 
+test:
+  stage: test
+  script:
+    - mvn test $MAVEN_CLI_OPTS
+
+verify:
+  stage: test
+  script:
+    - mvn verify $MAVEN_CLI_OPTS
+
 snapshot-gitlab:
   stage: publish
   script:
     - mvn deploy -Pgitlab-deploy $MAVEN_DEPLOY_CLI_OPTS $MAVEN_CLI_OPTS
+  only:
+    - main
 
 snapshot-nexus:
   stage: publish
   script:
     - mvn deploy -Pnexus-deploy $MAVEN_DEPLOY_CLI_OPTS $MAVEN_CLI_OPTS
+  only:
+    - main
 
 release-gitlab:
   stage: publish
-- 
GitLab