From cbf660b18219dbe8e868ec50235c4b70fa55f95a Mon Sep 17 00:00:00 2001 From: Bengt Brodersen Date: Tue, 27 Sep 2022 23:18:49 +0200 Subject: [PATCH] build(release): bump patch version --- CHANGELOG.md | 6 ++++++ README.md | 6 +++--- build.gradle | 14 +++++++------- .../GitVersioningPluginExtension.java | 6 ++++-- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39a1ff5..8a29c37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 6.3.2 + +##### Fixes +- Extend gitlab ci support for env var CI_MERGE_REQUEST_SOURCE_BRANCH_NAME + + ## 6.3.0 ##### Features diff --git a/README.md b/README.md index 6d9960f..c258b9b 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ This plugin can virtually set project version and properties, based on current * ```groovy plugins { - id 'me.qoomon.git-versioning' version '6.3.0' + id 'me.qoomon.git-versioning' version '6.3.2' } version = '0.0.0-SNAPSHOT' @@ -41,7 +41,7 @@ gitVersioning.apply { ```kotlin plugins { - id("me.qoomon.git-versioning") version "6.3.0" + id("me.qoomon.git-versioning") version "6.3.2" } @@ -339,7 +339,7 @@ You can provide those, by using [Parameters & Environment Variables](#parameters ### Native Support * GitHub Actions: if `$GITHUB_ACTIONS == true`, `GITHUB_REF` is considered -* GitLab CI: if `$GITLAB_CI == true`, `CI_COMMIT_BRANCH` and `CI_COMMIT_TAG` are considered +* GitLab CI: if `$GITLAB_CI == true`, `CI_COMMIT_BRANCH`, `CI_COMMIT_TAG` and `CI_MERGE_REQUEST_SOURCE_BRANCH_NAME` are considered * Circle CI: if `$CIRCLECI == true`, `CIRCLE_BRANCH` and `CIRCLE_TAG` are considered * Jenkins: if `JENKINS_HOME` is set, `BRANCH_NAME` and `TAG_NAME` are considered diff --git a/build.gradle b/build.gradle index c78d587..f762d3f 100644 --- a/build.gradle +++ b/build.gradle @@ -5,14 +5,14 @@ plugins { id "java-gradle-plugin" id 'com.adarshr.test-logger' version '3.2.0' - id "com.gradle.plugin-publish" version "1.0.0-rc-2" + id "com.gradle.plugin-publish" version "1.0.0" id "maven-publish" // for local testing only id "idea" } group 'me.qoomon' -version '6.3.1' +version '6.3.2' sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 @@ -21,12 +21,12 @@ repositories { } dependencies { - implementation 'org.eclipse.jgit:org.eclipse.jgit:6.1.0.202203080745-r' - implementation 'org.apache.maven:maven-artifact:3.8.5' - implementation 'org.apache.commons:commons-configuration2:2.7' + implementation 'org.eclipse.jgit:org.eclipse.jgit:6.3.0.202209071007-r' + implementation 'org.apache.maven:maven-artifact:3.8.6' + implementation 'org.apache.commons:commons-configuration2:2.8.0' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0-M1' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0-M1' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0' testImplementation 'org.assertj:assertj-core:3.23.1' } diff --git a/src/main/java/me/qoomon/gradle/gitversioning/GitVersioningPluginExtension.java b/src/main/java/me/qoomon/gradle/gitversioning/GitVersioningPluginExtension.java index d59e80e..cc31ca0 100644 --- a/src/main/java/me/qoomon/gradle/gitversioning/GitVersioningPluginExtension.java +++ b/src/main/java/me/qoomon/gradle/gitversioning/GitVersioningPluginExtension.java @@ -315,12 +315,14 @@ private GitSituation getGitSituation(File executionRootDirectory) throws IOExcep if (overrideBranch == null && overrideTag == null) { final String gitlabEnv = System.getenv("GITLAB_CI"); if (gitlabEnv != null && gitlabEnv.equals("true")) { - LOGGER.info("gather git situation from GitLab CI environment variables: CI_COMMIT_BRANCH and CI_COMMIT_TAG"); + LOGGER.info("gather git situation from GitLab CI environment variables: CI_COMMIT_BRANCH, CI_COMMIT_TAG and CI_MERGE_REQUEST_SOURCE_BRANCH_NAME"); String commitBranch = System.getenv("CI_COMMIT_BRANCH"); String commitTag = System.getenv("CI_COMMIT_TAG"); + String mrSourceBranch = System.getenv("CI_MERGE_REQUEST_SOURCE_BRANCH_NAME"); LOGGER.debug(" CI_COMMIT_BRANCH: " + commitBranch); LOGGER.debug(" CI_COMMIT_TAG: " + commitTag); - overrideBranch = commitBranch; + LOGGER.debug(" CI_MERGE_REQUEST_SOURCE_BRANCH_NAME: " + mrSourceBranch); + overrideBranch = commitBranch == null ? mrSourceBranch : commitBranch; overrideTag = commitTag; } }