diff --git a/first-class-pipeline/src/com/freeleaps/devops/SemanticReleasingExecutor.groovy b/first-class-pipeline/src/com/freeleaps/devops/SemanticReleasingExecutor.groovy index 0243765a..1e40e315 100644 --- a/first-class-pipeline/src/com/freeleaps/devops/SemanticReleasingExecutor.groovy +++ b/first-class-pipeline/src/com/freeleaps/devops/SemanticReleasingExecutor.groovy @@ -25,28 +25,19 @@ class SemanticReleasingExecutor { steps.dir(steps.env.workroot) { steps.withCredentials([steps.usernamePassword(credentialsId: credentialsId, passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) { + steps.env.GIT_CREDENTIALS = "${steps.env.GIT_USERNAME}:${steps.env.GIT_PASSWORD}"- steps.log.info("SemanticReleasingExecutor", "Installing semantic-release requirements...") steps.sh "apt-get -y update && apt-get install -y --no-install-recommends git apt-transport-https ca-certificates curl wget gnupg" - steps.log.warn("SemanticReleasingExecutor", "Setting up git credentials, execute workaround for semantic-release integrate with Azure DevOps") - // TODO: This should be supported by semantic-release itself, not a workaround here - steps.sh "git config --global http.extraheader \"AUTHORIZATION: Bearer ${steps.env.GIT_PASSWORD}\"" steps.writeFile file: '.releaserc.json', text: steps.libraryResource(config) steps.log.info("SemanticReleasingExecutor", "Installing semantic-release plugins...") steps.sh "npm install -g ${plugins.join(' ')}" steps.sh "git config --global --add safe.directory ${steps.env.workroot}" - // TODO: Workaround for semantic-release not committing changes - steps.sh "git config user.name \"freeleaps-gitops-bot\"" - steps.sh "git config user.email \"gitops@mathmast.com\"" - steps.sh "semantic-release --debug --no-ci" + steps.sh "semantic-release --debug" steps.log.info("SemanticReleasingExecutor", "Semantic release completed, read latest version from VERSION file") def released = steps.sh(script: 'test -f "VERSION"', returnStatus: true) == 0 if (released) { steps.env.LATEST_VERSION = steps.readFile('VERSION').trim() steps.env.SEMANTIC_RELEASED = true - // TODO: Workaround for semantic-release not committing changes - def repoUrl = steps.sh(script: 'git config --get remote.origin.url', returnStdout: true).trim() - steps.sh "git remote add ci_origin ${repoUrl}" - steps.sh "git push ci_origin HEAD:master" } } }