diff --git a/src/main/groovy/org/ajoberstar/gradle/git/publish/GitPublishPlugin.groovy b/src/main/groovy/org/ajoberstar/gradle/git/publish/GitPublishPlugin.groovy index 47ef08b..a5d02a8 100644 --- a/src/main/groovy/org/ajoberstar/gradle/git/publish/GitPublishPlugin.groovy +++ b/src/main/groovy/org/ajoberstar/gradle/git/publish/GitPublishPlugin.groovy @@ -52,7 +52,7 @@ class GitPublishPlugin implements Plugin { Task reset = createResetTask(project, extension) Task copy = createCopyTask(project, extension) Task commit = createCommitTask(project, extension) - Task push = createPushTask(project, extension) + Task push = createPushTask(project, extension, commit) push.dependsOn commit commit.dependsOn copy copy.dependsOn reset @@ -151,13 +151,13 @@ class GitPublishPlugin implements Plugin { return task } - private Task createPushTask(Project project, GitPublishExtension extension) { + private Task createPushTask(Project project, GitPublishExtension extension, Task commit) { Task task = project.tasks.create(PUSH_TASK) task.with { group = 'publishing' description = 'Pushes changes to git.' // if we didn't commit anything, don't push anything - onlyIf { dependsOnTaskDidWork() } + onlyIf { commit.didWork } doLast { extension.repo.push() }