-
-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to skip merging release into production branch - closes #74
- Loading branch information
1 parent
717be90
commit af7a8a1
Showing
11 changed files
with
169 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.amashchenko.maven.plugin</groupId> | ||
<artifactId>gitflow-maven-test</artifactId> | ||
<packaging>pom</packaging> | ||
<version>0.0.4-SNAPSHOT</version> | ||
</project> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.amashchenko.maven.plugin</groupId> | ||
<artifactId>gitflow-maven-test</artifactId> | ||
<packaging>pom</packaging> | ||
<version>0.0.1</version> | ||
</project> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
build.log | ||
expected-development-pom.xml | ||
expected-production-pom.xml | ||
invoker.properties | ||
init.bsh | ||
verify.bsh |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import org.codehaus.plexus.util.FileUtils; | ||
|
||
try { | ||
new File(basedir, "gitignorefile").renameTo(new File(basedir, ".gitignore")); | ||
|
||
Process p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " init"); | ||
p.waitFor(); | ||
|
||
Process p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " config user.email 'a@a.aa'"); | ||
p.waitFor(); | ||
Process p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " config user.name 'a'"); | ||
p.waitFor(); | ||
|
||
p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " add ."); | ||
p.waitFor(); | ||
|
||
p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " commit -m init"); | ||
p.waitFor(); | ||
|
||
p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " branch develop"); | ||
p.waitFor(); | ||
|
||
p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " checkout -b release/0.0.3"); | ||
p.waitFor(); | ||
|
||
File pomfile = new File(basedir, "pom.xml"); | ||
String pomfilestr = FileUtils.fileRead(pomfile, "UTF-8"); | ||
pomfilestr = pomfilestr.replaceAll("0.0.1", "0.0.3"); | ||
FileUtils.fileWrite(basedir + "/pom.xml", "UTF-8", pomfilestr); | ||
|
||
p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " add ."); | ||
p.waitFor(); | ||
|
||
p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " commit -m 0.0.3"); | ||
p.waitFor(); | ||
|
||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
return false; | ||
} | ||
return true; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:release-finish -DpushRemote=false -DskipReleaseMergeProdBranch | ||
|
||
invoker.description=Test release-finish with skipReleaseMergeProdBranch parameter. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.amashchenko.maven.plugin</groupId> | ||
<artifactId>gitflow-maven-test</artifactId> | ||
<packaging>pom</packaging> | ||
<version>0.0.1</version> | ||
</project> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import org.codehaus.plexus.util.FileUtils; | ||
|
||
try { | ||
File gitTag = new File(basedir, ".git/refs/tags/0.0.3"); | ||
if (!gitTag.exists()) { | ||
System.out.println("release-finish .git/refs/tags/0.0.3 doesn't exist"); | ||
return false; | ||
} | ||
|
||
File gitReleaseRef = new File(basedir, ".git/refs/heads/release/0.0.3"); | ||
if (gitReleaseRef.exists()) { | ||
System.out.println("release-finish .git/refs/heads/release/0.0.3 exists"); | ||
return false; | ||
} | ||
File gitDevelopRef = new File(basedir, ".git/refs/heads/develop"); | ||
if (!gitDevelopRef.exists()) { | ||
System.out.println("release-finish .git/refs/heads/develop doesn't exist"); | ||
return false; | ||
} | ||
File gitMasterRef = new File(basedir, ".git/refs/heads/master"); | ||
if (!gitMasterRef.exists()) { | ||
System.out.println("release-finish .git/refs/heads/master doesn't exist"); | ||
return false; | ||
} | ||
|
||
File file = new File(basedir, "pom.xml"); | ||
File expectedFile = new File(basedir, "expected-development-pom.xml"); | ||
|
||
String actual = FileUtils.fileRead(file, "UTF-8"); | ||
String expected = FileUtils.fileRead(expectedFile, "UTF-8"); | ||
|
||
actual = actual.replaceAll("\\r?\\n", ""); | ||
expected = expected.replaceAll("\\r?\\n", ""); | ||
|
||
if (!expected.equals(actual)) { | ||
System.out.println("release-finish expected development pom: " + expected + " actual was:" + actual); | ||
return false; | ||
} | ||
|
||
p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " checkout master"); | ||
p.waitFor(); | ||
|
||
file = new File(basedir, "pom.xml"); | ||
expectedFile = new File(basedir, "expected-production-pom.xml"); | ||
|
||
actual = FileUtils.fileRead(file, "UTF-8"); | ||
expected = FileUtils.fileRead(expectedFile, "UTF-8"); | ||
|
||
actual = actual.replaceAll("\\r?\\n", ""); | ||
expected = expected.replaceAll("\\r?\\n", ""); | ||
|
||
if (!expected.equals(actual)) { | ||
System.out.println("release-finish expected production pom: " + expected + " actual was:" + actual); | ||
return false; | ||
} | ||
|
||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
return false; | ||
} | ||
return true; |
This file contains 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
This file contains 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
This file contains 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
This file contains 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