Created
August 19, 2013 21:46
-
-
Save willis7/6274554 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript{ | |
repositories{ | |
mavenCentral() | |
} | |
dependencies{ | |
classpath 'com.atlassian.jgitflow:jgit-flow-core:0.9' | |
} | |
} | |
import com.atlassian.jgitflow.core.* | |
import com.atlassian.jgitflow.core.exception.* | |
task initFlow << { | |
//your local working copy is now on the develop branch | |
JGitFlow flow = JGitFlow.getOrInit(new File(".")) | |
} | |
task releaseStart << { | |
JGitFlow flow = JGitFlow.getOrInit(new File(".")) | |
//try to start our release | |
try | |
{ | |
flow.releaseStart("1.0").call() | |
} | |
catch (ReleaseBranchExistsException e) | |
{ | |
//the release branch already exists, just check it out | |
try | |
{ | |
flow.git().checkout().setName(flow.getReleaseBranchPrefix() + "1.0").call() | |
} | |
catch (JGitFlowGitAPIException e1) | |
{ | |
logger.error("Something went wrong checking out the release branch") | |
} | |
} | |
catch (DirtyWorkingTreeException e) | |
{ | |
logger.error("you have un-committed changes!") | |
} | |
catch (BranchOutOfDateException e) | |
{ | |
logger.error("your local develop branch is behind the remote, please do a git pull") | |
} | |
//Note: your local working copy is now on release/1.0 | |
} | |
task releaseFinish << { | |
JGitFlow flow = JGitFlow.getOrInit(new File(".")) | |
//finish the release and push to the origin | |
try | |
{ | |
flow.releaseFinish("1.0").setPush(true).call(); | |
} | |
catch (DirtyWorkingTreeException e) | |
{ | |
logger.error("you have un-committed changes!") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment