Skip to content
Snippets Groups Projects
Commit 0693e1fb authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

Merge branch 'fix/git-config' into 'master'

fix(release): fix and clarify Git config in release process

See merge request to-be-continuous/maven!67
parents 23d2be3f 58320afa
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment