diff --git a/templates/gitlab-ci-maven.yml b/templates/gitlab-ci-maven.yml index f4f697c1ef09c79f2258c982ae06e7399cedb767..3911eef1e90852251b5f5c2c20d468a33742c678 100644 --- a/templates/gitlab-ci-maven.yml +++ b/templates/gitlab-ci-maven.yml @@ -175,6 +175,10 @@ stages: } function configure_scm_auth() { + log_info "Preparing Git repository for release..." + # set user info + git config --global user.email "${GITLAB_USER_EMAIL}" + git config --global user.name "${GITLAB_USER_NAME}" # shellcheck disable=SC2086 scm_url=$(mvn $MAVEN_CLI_OPTS $mvn_settings_opt $java_proxy_args org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.scm.developerConnection -q -DforceStdout | tail -n 1) if [[ $scm_url == "scm:git:https"* ]]; then @@ -198,8 +202,6 @@ stages: else echo "${GIT_PRIVATE_KEY}" | tr -d '\r' | ssh-add - fi - git config --global user.email "${GITLAB_USER_EMAIL}" - git config --global user.name "${GITLAB_USER_LOGIN}" else log_error "--- project scm.developerConnection is using SSH protocol but no SSH key configured." log_error "--- Please either specify the \$GIT_PRIVATE_KEY variable or change to https protocol with username/password credentials." @@ -559,9 +561,6 @@ mvn-release: stage: publish before_script: - !reference [ .mvn-base, before_script ] - - log_info "Preparing Git repository for release..." - - git config --global user.name $GITLAB_USER_ID - - git config --global user.email $GITLAB_USER_EMAIL - git checkout -B "$CI_COMMIT_REF_NAME" script: - configure_scm_auth @@ -571,10 +570,10 @@ mvn-release: then if [ -z "${SEMREL_INFO_NEXT_VERSION}" ] then - log_info "no new version to release" + log_info "No next release version determined by semantic-release info: skip" exit 0 else - log_info "semantic-release info is activated, using computed next version for release \\e[1;94m${SEMREL_INFO_NEXT_VERSION}\\e[0m" + log_info "Use next release version determined by semantic-release info: \\e[1;94m${SEMREL_INFO_NEXT_VERSION}\\e[0m" semrel_args="-DreleaseVersion=${SEMREL_INFO_NEXT_VERSION}" fi fi