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: ...@@ -175,6 +175,10 @@ stages:
} }
function configure_scm_auth() { 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 # 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) 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 if [[ $scm_url == "scm:git:https"* ]]; then
...@@ -198,8 +202,6 @@ stages: ...@@ -198,8 +202,6 @@ stages:
else else
echo "${GIT_PRIVATE_KEY}" | tr -d '\r' | ssh-add - echo "${GIT_PRIVATE_KEY}" | tr -d '\r' | ssh-add -
fi fi
git config --global user.email "${GITLAB_USER_EMAIL}"
git config --global user.name "${GITLAB_USER_LOGIN}"
else else
log_error "--- project scm.developerConnection is using SSH protocol but no SSH key configured." 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." 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: ...@@ -559,9 +561,6 @@ mvn-release:
stage: publish stage: publish
before_script: before_script:
- !reference [ .mvn-base, 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" - git checkout -B "$CI_COMMIT_REF_NAME"
script: script:
- configure_scm_auth - configure_scm_auth
...@@ -571,10 +570,10 @@ mvn-release: ...@@ -571,10 +570,10 @@ mvn-release:
then then
if [ -z "${SEMREL_INFO_NEXT_VERSION}" ] if [ -z "${SEMREL_INFO_NEXT_VERSION}" ]
then then
log_info "no new version to release" log_info "No next release version determined by semantic-release info: skip"
exit 0 exit 0
else 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}" semrel_args="-DreleaseVersion=${SEMREL_INFO_NEXT_VERSION}"
fi fi
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