Merge pull request #182 from vito/git-deploy-use-branch
git deploy pushes to given branch (default master)
This commit is contained in:
commit
2241b5bb81
1 changed files with 7 additions and 2 deletions
|
@ -23,6 +23,11 @@ func (g *Git) Write(f *buildfile.Buildfile) {
|
||||||
// add target as a git remote
|
// add target as a git remote
|
||||||
f.WriteCmd(fmt.Sprintf("git remote add deploy %s", g.Target))
|
f.WriteCmd(fmt.Sprintf("git remote add deploy %s", g.Target))
|
||||||
|
|
||||||
|
destinationBranch := g.Branch
|
||||||
|
if destinationBranch == "" {
|
||||||
|
destinationBranch = "master"
|
||||||
|
}
|
||||||
|
|
||||||
switch g.Force {
|
switch g.Force {
|
||||||
case true:
|
case true:
|
||||||
// this is useful when the there are artifacts generated
|
// this is useful when the there are artifacts generated
|
||||||
|
@ -30,9 +35,9 @@ func (g *Git) Write(f *buildfile.Buildfile) {
|
||||||
// that need to be deployed to git remote.
|
// that need to be deployed to git remote.
|
||||||
f.WriteCmd(fmt.Sprintf("git add -A"))
|
f.WriteCmd(fmt.Sprintf("git add -A"))
|
||||||
f.WriteCmd(fmt.Sprintf("git commit -m 'add build artifacts'"))
|
f.WriteCmd(fmt.Sprintf("git commit -m 'add build artifacts'"))
|
||||||
f.WriteCmd(fmt.Sprintf("git push deploy $COMMIT:master --force"))
|
f.WriteCmd(fmt.Sprintf("git push deploy $COMMIT:%s --force", destinationBranch))
|
||||||
case false:
|
case false:
|
||||||
// otherwise we just do a standard git push
|
// otherwise we just do a standard git push
|
||||||
f.WriteCmd(fmt.Sprintf("git push deploy $COMMIT:master"))
|
f.WriteCmd(fmt.Sprintf("git push deploy $COMMIT:%s", destinationBranch))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue