Ensure working directory is clean when releasing

[MAILPOET-2004]
This commit is contained in:
Pavel Dohnal
2019-05-23 10:05:54 +02:00
committed by M. Shull
parent 4a04e588cf
commit 68c4ad88cb

View File

@ -530,6 +530,9 @@ class RoboFile extends \Robo\Tasks {
->addCode(function () use ($version) {
return $this->releaseCheckIssues($version);
})
->addCode(function () {
$this->prepareGit();
})
->addCode(function () use ($version) {
return $this->releaseVersionWrite($version);
})
@ -553,6 +556,16 @@ class RoboFile extends \Robo\Tasks {
}
}
public function releasePrepareGit() {
$git_status = $this->taskGitStack()
->printOutput(false)
->exec('git status --porcelain')
->run();
if (strlen(trim($git_status->getMessage())) > 0) {
throw new \Exception('Please make sure your working directory is clean before running release.');
}
}
public function releasePublish($version = null) {
$version = $this->releaseVersionGetNext($version);
return $this->collectionBuilder()