This is a Gradle Plugin which adds tasks to Gradle to support the Gitflow Workflow. The Gitflow Workflow provides a robust framework for managing larger projects. The Plugin uses org.eclipse.jgit
and external.atlassian.jgitflow:jgit-flow-core
to implement the Gitflow Workflow. The project is inspired by the JGitFlow Maven Plugin.
The Plugin adds the task group jgitflow
which contains the following tasks:
-
initJGitflow
: Initializes the JGitflow context. Creates a develop branch and switches to develop branch. -
releaseStart
: Creates a release branchrelease/<releaseVersion>
from a develop branch and updates thegradle.properties
file with a release version. Switches to release branch. -
releaseFinish
: Merges a release branch back into the master branch and develop branch. Tags the release. Removes the release branch. Pushes everything to the remote origin. Switches back to develop branch. -
releasePublish
: Publishes a release branch to the remote origin. -
featureStart
: Creates a feature branchfeature/<featureName>
from a develop branch. Switches to feature branch. -
featureFinish
: Merges a feature branch back into the develop branch. Removes the feature branch. Switches back to develop branch. -
featurePublish
: Publishes a feature branch to the remote origin. -
hotfixStart
: Creates a hotfix branchhotfix/<hotfixName>
from a master branch. Switches to hotfix branch. -
hotfixFinish
: Merges a hotfix branch back into the master branch and develop branch. Additionally the master merge is tagged with the hotfix version. Switches back to develop branch. -
hotfixPublish
: Publishes a hotfix branch to the remote origin.
The project requires at least JDK 7. The project eats its own dog food.
Add the following snippet to your Gradle build file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'io.github.robwin:jgitflow-gradle-plugin:0.3.1'
}
}
apply plugin: 'io.github.robwin.jgitflow'
The default jgitflow
context configuration looks as follows:
Logical branch name | Real branch name |
---|---|
master |
"master" |
develop |
"develop" |
feature |
"feature/<featureName>" |
release |
"release/<releaseVersion>" |
hotfix |
"hotfix/<hotfixName>"; |
By default a release tag has no version prefix.
Before you can use the tasks, you must initialize the JGitflow context.
gradlew initJGitflow
If you want to change the JGitflow context configuration, you can do the following.
initJGitflow{
feature = "features/"
release = "releases/"
versiontag = 'v'
}
If you want to push changes to a remote origin, you must specify your username and password in a ~/.gradle/gradle.properties
file or as a command line parameter.
SSH is not supported yet.
The task exposes a few properties as part of its configuration.
Mandatory | Property | Description | Type | Default |
---|---|---|---|---|
Yes |
releaseVersion |
The version of the release |
String |
empty |
No |
allowSnapshotDependencies |
Allow snapshot library dependencies |
Boolean |
false |
No |
baseCommit |
You can optionally supply a base commit sha-1 hash to start the release from. The commit must be on the develop branch. |
String |
empty |
Mandatory | Property | Description | Type | Default |
---|---|---|---|---|
Yes |
releaseVersion |
The version of the release |
String |
empty |
Yes |
newVersion |
The new version of the develop branch |
String |
empty |
The task exposes a few properties as part of its configuration.
Mandatory | Property | Description | Type | Default |
---|---|---|---|---|
Yes |
featureName |
The name of the feature |
String |
empty |
Mandatory | Property | Description | Type | Default |
---|---|---|---|---|
Yes |
featureName |
The name of the feature |
String |
empty |
The task exposes a few properties as part of its configuration.
Mandatory | Property | Description | Type | Default |
---|---|---|---|---|
Yes |
hotfixName |
The name of the hotfix |
String |
empty |
No |
baseCommit |
You can optionally supply a base commit sha-1 hash to start the hotfix from. The commit must be on the master branch. |
String |
empty |
Copyright 2015 Robert Winkler
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.