diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 621435f..018817c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -35,12 +35,21 @@ cache:
# For merge requests do not `deploy` but only run `verify`.
# See https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
.verify: &verify
+ stages:
+ - test
+ - upload artifacts
stage: test
script:
- 'mvn $MAVEN_CLI_OPTS verify'
except:
variables:
- $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
+ stage: upload artifacts
+ script:
+ - 'mvn $MAVEN_CLI_OPTS deploy -s ci_settings.xml'
+ except:
+ variables:
+ - $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
# Verify merge requests using JDK8
build:
@@ -56,7 +65,13 @@ upload artifacts:
- if [ ! -f ci_settings.xml ];
then echo "CI settings missing\! If deploying to GitLab Maven Repository, please see https://docs.gitlab.com/ee/user/packages/maven_repository/index.html#create-maven-packages-with-gitlab-cicd for instructions.";
fi
- - 'mvn $MAVEN_CLI_OPTS deploy -s ci_settings.xml'
+ - eval $(ssh-agent -s)
+ - ssh-add <(echo "$GITLAB_RUNNER_KEY")
+ - mkdir -p ~/.ssh
+ - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
+ - git checkout -B "$CI_BUILD_REF_NAME"
+ - 'mvn -B release:prepare -s ci_settings.xml'
+ - 'mvn -B release:perform -s ci_settings.xml'
only:
variables:
- $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
diff --git a/pom.xml b/pom.xml
index d4003a2..8b129eb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -97,6 +97,14 @@
+
+ org.apache.maven.plugins
+ maven-release-plugin
+ 2.5.1
+
+ [skip ci] [maven-release-plugin]
+
+
maven-failsafe-plugin
${surefire-plugin.version}